Search in sources :

Example 1 with LoadIR

use of com.googlecode.aviator.code.interpreter.ir.LoadIR in project aviatorscript by killme2008.

the class InterpretCodeGenerator method onConstant.

@Override
public void onConstant(final Token<?> lookhead) {
    if (LOAD_CONSTANTS_TYPE.contains(lookhead.getType())) {
        VariableMeta meta = null;
        if (lookhead.getType() == TokenType.Variable) {
            meta = this.variables.get(lookhead.getLexeme());
        }
        emit(new LoadIR(this.sourceFile, lookhead, meta, this.constantPool.contains(lookhead)));
    }
}
Also used : LoadIR(com.googlecode.aviator.code.interpreter.ir.LoadIR) VariableMeta(com.googlecode.aviator.parser.VariableMeta)

Example 2 with LoadIR

use of com.googlecode.aviator.code.interpreter.ir.LoadIR in project aviatorscript by killme2008.

the class InterpretExpression method loadConstants.

private void loadConstants(final Set<Token<?>> constants, final List<IR> instruments) {
    final Env env = new Env();
    env.setInstance(this.instance);
    InterpretContext ctx = new InterpretContext(this, instruments, env);
    for (Token<?> token : constants) {
        final LoadIR loadConstantIR = new LoadIR(this.sourceFile, token, null, false);
        loadConstantIR.evalWithoutDispatch(ctx);
        this.constantPool.put(token, ctx.pop());
    }
}
Also used : InterpretContext(com.googlecode.aviator.code.interpreter.InterpretContext) LoadIR(com.googlecode.aviator.code.interpreter.ir.LoadIR) Env(com.googlecode.aviator.utils.Env)

Aggregations

LoadIR (com.googlecode.aviator.code.interpreter.ir.LoadIR)2 InterpretContext (com.googlecode.aviator.code.interpreter.InterpretContext)1 VariableMeta (com.googlecode.aviator.parser.VariableMeta)1 Env (com.googlecode.aviator.utils.Env)1