Module dev.civl.abc

Interface CompoundLiteralObject

All Superinterfaces:
Iterable<LiteralObject>, LiteralObject

public interface CompoundLiteralObject extends LiteralObject, Iterable<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

    Modifier and Type
    Method
    Description
    get(int index)
    Return the index-th element of this compound literal.
    Returns the corresponding AST node of the compound literal object.
    int
    Returns the number of members of this compound literal.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator

    Methods 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

      LiteralObject get(int index)
      Return the index-th element of this compound literal. May be null.
      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