Class: Idl::EnumArrayCastAst
Overview
represents the builtin that returns an array with all elements of an Enum type
$enum_to_a(PrivilegeMode) #=> [3, 1, 1, 0, 5, 4]
Instance Method Summary collapse
- #enum_class ⇒ Object
-
#initialize(input, interval, enum_class_name) ⇒ EnumArrayCastAst
constructor
A new instance of EnumArrayCastAst.
- #to_idl ⇒ Object
- #type(symtab) ⇒ Object
- #type_check(symtab) ⇒ Object
- #value(symtab) ⇒ Object
Constructor Details
#initialize(input, interval, enum_class_name) ⇒ EnumArrayCastAst
Returns a new instance of EnumArrayCastAst.
942 943 944 |
# File 'lib/idl/ast.rb', line 942 def initialize(input, interval, enum_class_name) super(input, interval, [enum_class_name]) end |
Instance Method Details
#enum_class ⇒ Object
940 |
# File 'lib/idl/ast.rb', line 940 def enum_class = children[0] |
#to_idl ⇒ Object
963 |
# File 'lib/idl/ast.rb', line 963 def to_idl = "$enum_to_a(#{enum_class.to_idl})" |
#type(symtab) ⇒ Object
950 951 952 953 954 955 956 957 |
# File 'lib/idl/ast.rb', line 950 def type(symtab) Type.new( :array, width: enum_class.type(symtab).element_values.size, sub_type: Type.new(:bits, width: enum_class.type(symtab).width, qualifiers: [:const]), qualifiers: [:const] ) end |
#type_check(symtab) ⇒ Object
946 947 948 |
# File 'lib/idl/ast.rb', line 946 def type_check(symtab) enum_class.type_check(symtab) end |
#value(symtab) ⇒ Object
959 960 961 |
# File 'lib/idl/ast.rb', line 959 def value(symtab) enum_class.type(symtab).element_values end |