Class: Idl::DontCareReturnAst
- Includes:
- Rvalue
- Defined in:
- lib/idl/ast.rb
Overview
represents a don’t care return value
for exaple:
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.
3827 3828 3829 |
# File 'lib/idl/ast.rb', line 3827 def initialize(input, interval) super(input, interval, EMPTY_ARRAY) end |
Instance Method Details
#set_expected_type(t) ⇒ Object
3855 3856 3857 |
# File 'lib/idl/ast.rb', line 3855 def set_expected_type(t) @expected_type = t end |
#to_idl ⇒ Object
3859 |
# File 'lib/idl/ast.rb', line 3859 def to_idl = "-" |
#type(_symtab) ⇒ Type
Return the type of this node
3837 3838 3839 |
# File 'lib/idl/ast.rb', line 3837 def type(_symtab) Type.new(:dontcare) end |
#type_check(_symtab) ⇒ Object
3832 3833 3834 |
# File 'lib/idl/ast.rb', line 3832 def type_check(_symtab) # nothing to do! end |
#value(_symtab) ⇒ Integer, Boolean
Return the compile-time-known value of the node
3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 |
# File 'lib/idl/ast.rb', line 3842 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