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
Modifier and TypeFieldDescriptionint[]
The vector of function indices to reference in the init exprs, ornull
if theinit expressions
are explicitly declared.The offset expression of an active element segment, ornull
if it is not active.boolean
Whether the element segment is passive, if it is not active.int
The table index of the element segment, if it is active.byte
The reftype of the element segment.Fields inherited from class io.github.eutro.jwasm.BaseVisitor
dl
-
Constructor Summary
ConstructorDescriptionConstruct a visitor with no delegate.ElementNode
(@Nullable ElementVisitor dl) Construct a visitor with a delegate. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(ElementVisitor eev) Make the givenElementVisitor
visit this element.iterator()
Returns an iterator over the init expressions in this element segment, whether they beimplicitly derived from function indices
orexplicitly declared
.int
size()
The number of init expressions in this element segment, the size ofiterator()
.visitActiveMode
(int table) Visit thetable
index andoffset
expr of an active element segment.void
visitElemIndices
(int[] indices) Visit a vector of function indices to reference in the init exprs.Visit a single expr in the vector ofinit
exprs.void
visitNonActiveMode
(boolean passive) Visit the mode of an element segment that is not active.void
visitType
(byte type) Visit thetype
of the element segment.Methods inherited from class io.github.eutro.jwasm.BaseVisitor
visitEnd
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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, ornull
if 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, ornull
if theinit expressions
are 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 givenElementVisitor
visit 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:ElementVisitor
Visit the mode of an element segment that is not active.- Overrides:
visitNonActiveMode
in classElementVisitor
- Parameters:
passive
-true
if the mode ispassive
, orfalse
if it isdeclarative
.
-
visitActiveMode
Description copied from class:ElementVisitor
Visit thetable
index andoffset
expr of an active element segment.- Overrides:
visitActiveMode
in classElementVisitor
- Parameters:
table
- The table index of the element segment.- Returns:
- An
ExprVisitor
to visit with the contents of theoffset
expr, ornull
if this visitor is not interested in the contents of theoffset
expr.
-
visitType
public void visitType(byte type) Description copied from class:ElementVisitor
Visit thetype
of the element segment.- Overrides:
visitType
in classElementVisitor
- 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 classElementVisitor
- Parameters:
indices
- The vector of function indices to reference in the init exprs.
-
visitInit
Description copied from class:ElementVisitor
Visit a single expr in the vector ofinit
exprs.This should be called instead of
ElementVisitor.visitElemIndices(int[])
, not in conjunction with it.- Overrides:
visitInit
in classElementVisitor
- Returns:
- An
ExprVisitor
to visit with the contents of theinit
expr, ornull
if this visitor is not interested in the contents of theinit
expr.
-
iterator
Returns an iterator over the init expressions in this element segment, whether they beimplicitly derived from function indices
orexplicitly declared
.
-