public class PushConst extends java.lang.Object implements Instruction
PUSH( CONST )
Modifier and Type | Field and Description |
---|---|
protected @NotNull java.lang.String |
constant
The constant to be pushed.
|
protected @Nullable Tree |
tree
The tree of this instruction.
|
Constructor and Description |
---|
PushConst(@NotNull java.lang.String constant)
Construct a new instruction that pushes the given
constant to the stack. |
PushConst(@NotNull Tree tree)
Construct a new instruction that pushes the content of the given
tree to
the stack. |
PushConst(@NotNull Tree tree,
@NotNull java.lang.String constant)
Construct a new instruction that pushes the given
constant to the stack. |
Modifier and Type | Method and Description |
---|---|
void |
exec(@NotNull Environment environment,
@NotNull Memory memory)
Execute this instruction with the given
environment and memory . |
@Nullable Tree |
getTree()
Return the tree from where this instruction was declared.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create, create
@NotNull protected final @NotNull java.lang.String constant
@Nullable protected final @Nullable Tree tree
public PushConst(@NotNull @NotNull Tree tree)
tree
to
the stack.tree
- the tree of the constructed instruction.java.lang.NullPointerException
- if the given tree
is null.public PushConst(@NotNull @NotNull java.lang.String constant)
constant
to the stack.constant
- the constant to be pushed.java.lang.NullPointerException
- if the given constant
is null.public PushConst(@NotNull @NotNull Tree tree, @NotNull @NotNull java.lang.String constant)
constant
to the stack.tree
- the tree of the constructed instruction.constant
- the constant to be pushed.java.lang.NullPointerException
- if the given tree
or constant
is
null.public void exec(@NotNull @NotNull Environment environment, @NotNull @NotNull Memory memory)
Instruction
environment
and memory
.exec
in interface Instruction
environment
- the environment this instruction is executed in.memory
- the memory holding the variables for this instruction to depend
on.@Nullable public @Nullable Tree getTree()
Instruction
getTree
in interface Instruction