Class ElementNode

All Implemented Interfaces:
Iterable<ExprNode>

public class ElementNode extends ElementVisitor implements Iterable<ExprNode>
A node that represents an element segment in the element section of a module.
See Also:
  • Field Details

    • passive

      public boolean passive
      Whether the element segment is passive, if it is not active.

      True if passive, false if declarative, ignored if active.

      See Also:
    • table

      public int table
      The table index of the element segment, if it is active.
    • offset

      public ExprNode offset
      The offset expression of an active element segment, or null if it is not active.
    • type

      public byte type
      The reftype of the element segment.
    • indices

      public int[] indices
      The vector of function indices to reference in the init exprs, or null if the init expressions are explicitly declared.
      See Also:
    • init

      public List<ExprNode> init
      The vector of init exprs, or null if the function indices should be used.
      See Also:
  • Constructor Details

    • ElementNode

      public ElementNode()
      Construct a visitor with no delegate.
    • ElementNode

      public ElementNode(@Nullable @Nullable ElementVisitor dl)
      Construct a visitor with a delegate.
      Parameters:
      dl - The visitor to delegate all method calls to, or null.
  • Method Details

    • accept

      public void accept(ElementVisitor eev)
      Make the given ElementVisitor visit this element.
      Parameters:
      eev - The visitor to visit.
    • size

      public int size()
      The number of init expressions in this element segment, the size of iterator().
      Returns:
      The number of expressions in this element segment.
    • visitNonActiveMode

      public void visitNonActiveMode(boolean passive)
      Description copied from class: ElementVisitor
      Visit the mode of an element segment that is not active.
      Overrides:
      visitNonActiveMode in class ElementVisitor
      Parameters:
      passive - true if the mode is passive, or false if it is declarative.
    • visitActiveMode

      public ExprVisitor visitActiveMode(int table)
      Description copied from class: ElementVisitor
      Visit the table index and offset expr of an active element segment.
      Overrides:
      visitActiveMode in class ElementVisitor
      Parameters:
      table - The table index of the element segment.
      Returns:
      An ExprVisitor to visit with the contents of the offset expr, or null if this visitor is not interested in the contents of the offset expr.
    • visitType

      public void visitType(byte type)
      Description copied from class: ElementVisitor
      Visit the type of the element segment.
      Overrides:
      visitType in class ElementVisitor
      Parameters:
      type - The reftype of the element segment.
    • visitElemIndices

      public void visitElemIndices(int[] indices)
      Description copied from class: ElementVisitor
      Visit a vector of function indices to reference in the init exprs.

      This should be called instead of ElementVisitor.visitInit(), not in conjunction with it.

      Overrides:
      visitElemIndices in class ElementVisitor
      Parameters:
      indices - The vector of function indices to reference in the init exprs.
    • visitInit

      public ExprVisitor visitInit()
      Description copied from class: ElementVisitor
      Visit a single expr in the vector of init exprs.

      This should be called instead of ElementVisitor.visitElemIndices(int[]), not in conjunction with it.

      Overrides:
      visitInit in class ElementVisitor
      Returns:
      An ExprVisitor to visit with the contents of the init expr, or null if this visitor is not interested in the contents of the init expr.
    • iterator

      @NotNull public @NotNull Iterator<ExprNode> iterator()
      Returns an iterator over the init expressions in this element segment, whether they be implicitly derived from function indices or explicitly declared.
      Specified by:
      iterator in interface Iterable<ExprNode>
      Returns:
      An iterator over the init expressions in this element segment.