Package io.github.eutro.jwasm.tree
Class ElementNode
java.lang.Object
io.github.eutro.jwasm.BaseVisitor<ElementVisitor>
io.github.eutro.jwasm.ElementVisitor
io.github.eutro.jwasm.tree.ElementNode
A node that represents an
element segment
in the
element section
of a module.
-
Field Summary
FieldsModifier and TypeFieldDescriptionint[]The vector of function indices to reference in the init exprs, ornullif theinit expressionsare explicitly declared.The offset expression of an active element segment, ornullif it is not active.booleanWhether the element segment is passive, if it is not active.intThe table index of the element segment, if it is active.byteThe reftype of the element segment.Fields inherited from class io.github.eutro.jwasm.BaseVisitor
dl -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a visitor with no delegate.ElementNode(@Nullable ElementVisitor dl) Construct a visitor with a delegate. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ElementVisitor eev) Make the givenElementVisitorvisit this element.iterator()Returns an iterator over the init expressions in this element segment, whether they beimplicitly derived from function indicesorexplicitly declared.intsize()The number of init expressions in this element segment, the size ofiterator().visitActiveMode(int table) Visit thetableindex andoffsetexpr of an active element segment.voidvisitElemIndices(int[] indices) Visit a vector of function indices to reference in the init exprs.Visit a single expr in the vector ofinitexprs.voidvisitNonActiveMode(boolean passive) Visit the mode of an element segment that is not active.voidvisitType(byte type) Visit thetypeof the element segment.Methods inherited from class io.github.eutro.jwasm.BaseVisitor
visitEndMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
passive
public boolean passiveWhether the element segment is passive, if it is not active.True if passive, false if declarative, ignored if active.
- See Also:
-
table
public int tableThe table index of the element segment, if it is active. -
offset
The offset expression of an active element segment, ornullif it is not active. -
type
public byte typeThe reftype of the element segment. -
indices
public int[] indicesThe vector of function indices to reference in the init exprs, ornullif theinit expressionsare explicitly declared.- See Also:
-
init
- See Also:
-
-
Constructor Details
-
ElementNode
public ElementNode()Construct a visitor with no delegate. -
ElementNode
Construct a visitor with a delegate.- Parameters:
dl- The visitor to delegate all method calls to, ornull.
-
-
Method Details
-
accept
Make the givenElementVisitorvisit this element.- Parameters:
eev- The visitor to visit.
-
size
public int size()The number of init expressions in this element segment, the size ofiterator().- Returns:
- The number of expressions in this element segment.
-
visitNonActiveMode
public void visitNonActiveMode(boolean passive) Description copied from class:ElementVisitorVisit the mode of an element segment that is not active.- Overrides:
visitNonActiveModein classElementVisitor- Parameters:
passive-trueif the mode ispassive, orfalseif it isdeclarative.
-
visitActiveMode
Description copied from class:ElementVisitorVisit thetableindex andoffsetexpr of an active element segment.- Overrides:
visitActiveModein classElementVisitor- Parameters:
table- The table index of the element segment.- Returns:
- An
ExprVisitorto visit with the contents of theoffsetexpr, ornullif this visitor is not interested in the contents of theoffsetexpr.
-
visitType
public void visitType(byte type) Description copied from class:ElementVisitorVisit thetypeof the element segment.- Overrides:
visitTypein classElementVisitor- Parameters:
type- The reftype of the element segment.
-
visitElemIndices
public void visitElemIndices(int[] indices) Description copied from class:ElementVisitorVisit 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:
visitElemIndicesin classElementVisitor- Parameters:
indices- The vector of function indices to reference in the init exprs.
-
visitInit
Description copied from class:ElementVisitorVisit a single expr in the vector ofinitexprs.This should be called instead of
ElementVisitor.visitElemIndices(int[]), not in conjunction with it.- Overrides:
visitInitin classElementVisitor- Returns:
- An
ExprVisitorto visit with the contents of theinitexpr, ornullif this visitor is not interested in the contents of theinitexpr.
-
iterator
Returns an iterator over the init expressions in this element segment, whether they beimplicitly derived from function indicesorexplicitly declared.
-