Class: Idl::DontCareReturnAst
- Includes:
- Rvalue
- Defined in:
- lib/idl/ast.rb
Overview
represents a don’t care return value
for example:
return -;
Instance Method Summary collapse
-
#initialize(input, interval) ⇒ DontCareReturnAst
constructor
A new instance of DontCareReturnAst.
- #set_expected_type(t) ⇒ Object
- #to_idl ⇒ Object
-
#type(_symtab) ⇒ Type
Return the type of this node.
- #type_check(_symtab) ⇒ Object
-
#value(_symtab) ⇒ Integer, Boolean
Return the compile-time-known value of the node.
-
#values(symtab) ⇒ Array<Integer>, ...
included
from Rvalue
Return a complete list of possible compile-time-known values of the node, or raise a ValueError if the full list cannot be determined.
Constructor Details
#initialize(input, interval) ⇒ DontCareReturnAst
Returns a new instance of DontCareReturnAst.
3850 3851 3852 |
# File 'lib/idl/ast.rb', line 3850 def initialize(input, interval) super(input, interval, EMPTY_ARRAY) end |
Instance Method Details
#set_expected_type(t) ⇒ Object
3878 3879 3880 |
# File 'lib/idl/ast.rb', line 3878 def set_expected_type(t) @expected_type = t end |
#to_idl ⇒ Object
3882 |
# File 'lib/idl/ast.rb', line 3882 def to_idl = "-" |
#type(_symtab) ⇒ Type
Return the type of this node
3860 3861 3862 |
# File 'lib/idl/ast.rb', line 3860 def type(_symtab) Type.new(:dontcare) end |
#type_check(_symtab) ⇒ Object
3855 3856 3857 |
# File 'lib/idl/ast.rb', line 3855 def type_check(_symtab) # nothing to do! end |
#value(_symtab) ⇒ Integer, Boolean
Return the compile-time-known value of the node
3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 |
# File 'lib/idl/ast.rb', line 3865 def value(_symtab) internal_error "Must call set_expected_type first" if @expected_type.nil? case @expected_type.kind when :bits 0 when :boolean false else internal_error "Unhandled expected type" end end |
#values(symtab) ⇒ Array<Integer>, ... Originally defined in module Rvalue
Return a complete list of possible compile-time-known values of the node, or raise a ValueError if the full list cannot be determined
For most AstNodes, this will just be a single-entry array