Class: Idl::ArrayLiteralAst
Instance Method Summary
collapse
Constructor Details
This class inherits a constructor from Idl::AstNode
Instance Method Details
#element_nodes ⇒ Object
3066
3067
3068
|
# File 'lib/idl/ast.rb', line 3066
def element_nodes
entries
end
|
#entries ⇒ Object
3064
|
# File 'lib/idl/ast.rb', line 3064
def entries = @children
|
#to_idl ⇒ Object
3089
|
# File 'lib/idl/ast.rb', line 3089
def to_idl = "[#{element_nodes.map(&:to_idl).join(',')}]"
|
#type(symtab) ⇒ Object
3081
3082
3083
|
# File 'lib/idl/ast.rb', line 3081
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
3071
3072
3073
3074
3075
3076
3077
3078
3079
|
# File 'lib/idl/ast.rb', line 3071
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
3085
3086
3087
|
# File 'lib/idl/ast.rb', line 3085
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