- All Superinterfaces:
Iterable<LiteralObject>,LiteralObject
A compound literal is an abstract representation of a literal array, struct, or union value in a C program. An instance of this class represents the abstract value that a compound initializer or compound literal expression defines.
Note: reads that go beyond the bounds of the inferred type will result in a
NoSuchElementException.
-
Method Summary
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface dev.civl.abc.ast.node.IF.compound.LiteralObject
getType
-
Method Details
-
size
int size()Returns the number of members of this compound literal. This will be consistent with the inferred type. For example, if the inferred type is "array of T of length 5", the size will be 5. If the inferred type is "struct S ...", the size will be the number of members of S. If the inferred type is "union S ..." the size will be 1.- Returns:
- the number of members of this compound literal value
-
get
Return the index-th element of this compound literal. May benull.- Parameters:
index- integer in range [0,size-1]- Returns:
- the object in position index in this compound literal
-
getSourceNode
ASTNode getSourceNode()Returns the corresponding AST node of the compound literal object.- Returns:
- the AST node corresponding to this compound literal
-