Class: Idl::EnumElementSizeAst
Overview
represents the builtin that returns the bitwidth of an element in an enum class
$enum_element_size(PrivilegeMode) #=> 3
Instance Method Summary collapse
- #enum_class ⇒ Object
-
#initialize(input, interval, enum_class_name) ⇒ EnumElementSizeAst
constructor
A new instance of EnumElementSizeAst.
- #to_idl ⇒ Object
- #type(symtab) ⇒ Object
- #type_check(symtab) ⇒ Object
- #value(symtab) ⇒ Object
Constructor Details
#initialize(input, interval, enum_class_name) ⇒ EnumElementSizeAst
Returns a new instance of EnumElementSizeAst.
862 863 864 |
# File 'lib/idl/ast.rb', line 862 def initialize(input, interval, enum_class_name) super(input, interval, [enum_class_name]) end |
Instance Method Details
#enum_class ⇒ Object
860 |
# File 'lib/idl/ast.rb', line 860 def enum_class = children[0] |
#to_idl ⇒ Object
878 |
# File 'lib/idl/ast.rb', line 878 def to_idl = "$enum_element_size(#{enum_class.to_idl})" |
#type(symtab) ⇒ Object
870 871 872 |
# File 'lib/idl/ast.rb', line 870 def type(symtab) Type.new(:bits, width: enum_class.type(symtab).width, qualifiers: [:const]) end |
#type_check(symtab) ⇒ Object
866 867 868 |
# File 'lib/idl/ast.rb', line 866 def type_check(symtab) enum_class.type_check(symtab) end |
#value(symtab) ⇒ Object
874 875 876 |
# File 'lib/idl/ast.rb', line 874 def value(symtab) enum_class.type(symtab).width end |