@NodeField(name = "slot", type = FrameSlot.class) public abstract class SymbolNode extends MumblerNode { public abstract FrameSlot getSlot(); @Override public String toString() { return "'" + this.getSlot().getIdentifier(); } }
/** * Created by Lucas Allan Amorim on 2014-09-14. */ @NodeField(name = "slot", type = FrameSlot.class) public class LuaReadArgumentNode extends LuaExpressionNode { private final int index; public LuaReadArgumentNode(int index) { this.index = index; } @Override public Object execute(VirtualFrame frame) { Object[] args = frame.getArguments(); if (index < args.length) { return args[index]; } else { return LuaNull.SINGLETON; } } }
@NodeField(name = "globalFrame", type = MaterializedFrame.class) public abstract class GlobalSymbolNode extends SymbolNode { public abstract MaterializedFrame getGlobalFrame(); @Specialization(rewriteOn = FrameSlotTypeException.class) protected long readLong(VirtualFrame virtualFrame) throws FrameSlotTypeException { return this.getGlobalFrame().getLong(this.getSlot()); } @Specialization(rewriteOn = FrameSlotTypeException.class) protected boolean readBoolean(VirtualFrame virtualFrame) throws FrameSlotTypeException { return this.getGlobalFrame().getBoolean(this.getSlot()); } @Specialization(rewriteOn = FrameSlotTypeException.class) protected Object readObject(VirtualFrame virtualFrame) throws FrameSlotTypeException { return this.getGlobalFrame().getObject(this.getSlot()); } @Specialization(contains = { "readLong", "readBoolean", "readObject", }) protected Object read(VirtualFrame virtualFrame) { return this.getGlobalFrame().getValue(this.getSlot()); } }
/** * Created by Lucas Allan Amorim on 2014-09-15. */ @NodeField(name = "slot", type = FrameSlot.class) public abstract class LuaReadLocalVariableNode extends LuaExpressionNode { protected abstract FrameSlot getSlot(); @Specialization(rewriteOn = FrameSlotTypeException.class) protected long readLong(VirtualFrame frame) throws FrameSlotTypeException { return frame.getLong(getSlot()); } @Specialization(rewriteOn = FrameSlotTypeException.class) protected boolean readBoolean(VirtualFrame frame) throws FrameSlotTypeException { return frame.getBoolean(getSlot()); } @Specialization(rewriteOn = FrameSlotTypeException.class) protected Object readObject(VirtualFrame frame) throws FrameSlotTypeException { return frame.getObject(getSlot()); } @Specialization(contains = {"readLong", "readBoolean", "readObject"}) protected Object read(VirtualFrame frame) { return frame.getValue(getSlot()); } }
@NodeField(name = "function", type = MumblerFunction.class) public abstract class LambdaNode extends MumblerNode { public abstract MumblerFunction getFunction();
@NodeField(name = "depth", type = int.class) public abstract class ClosureSymbolNode extends SymbolNode {
@NodeChild("literalNode") @NodeField(name = "kind", type = QuoteKind.class) public abstract class QuoteNode extends MumblerNode { public static enum QuoteKind {
@NodeField(name = "slot", type = FrameSlot.class) public abstract class LuaWriteLocalVariableNode extends LuaExpressionNode {
@NodeChild("valueNode") @NodeField(name = "slot", type = FrameSlot.class) public abstract class DefineNode extends MumblerNode { protected abstract FrameSlot getSlot();