Class: Idl::ArrayLiteralAst
Instance Method Summary
collapse
Constructor Details
This class inherits a constructor from Idl::AstNode
Instance Method Details
#element_nodes ⇒ Object
3053
3054
3055
|
# File 'lib/idl/ast.rb', line 3053
def element_nodes
entries
end
|
#entries ⇒ Object
3051
|
# File 'lib/idl/ast.rb', line 3051
def entries = @children
|
#to_idl ⇒ Object
3076
|
# File 'lib/idl/ast.rb', line 3076
def to_idl = "[#{element_nodes.map(&:to_idl).join(',')}]"
|
#type(symtab) ⇒ Object
3068
3069
3070
|
# File 'lib/idl/ast.rb', line 3068
def type(symtab)
Type.new(:array, width: element_nodes.size, sub_type: element_nodes[0].type(symtab))
end
|
#type_check(symtab) ⇒ void
This method returns an undefined value.
type check this node and all children
Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError
3058
3059
3060
3061
3062
3063
3064
3065
3066
|
# File 'lib/idl/ast.rb', line 3058
def type_check(symtab)
entries.each do |node|
node.type_check(symtab)
end
unless element_nodes.all? { |e| e.type(symtab).equal_to?(element_nodes[0].type(symtab)) }
type_error "Array elements must be identical"
end
end
|
#value(symtab) ⇒ Object
3072
3073
3074
|
# File 'lib/idl/ast.rb', line 3072
def value(symtab)
element_nodes.map { |e| e.value(symtab) }
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