Search in sources :

Example 1 with BranchUnlessIR

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

the class InterpretCodeGenerator method onAndLeft.

@Override
public void onAndLeft(final Token<?> lookhead) {
    if (!OperationRuntime.containsOpFunction(this.compileEnv, OperatorType.AND)) {
        emit(new AssertTypeIR(AssertTypes.Bool));
        Label label = makeLabel();
        pushLabel0(label);
        this.instruments.add(new BranchUnlessIR(label, new SourceInfo(this.sourceFile, lookhead.getLineNo())));
        emit(PopIR.INSTANCE);
    }
}
Also used : SourceInfo(com.googlecode.aviator.code.interpreter.ir.SourceInfo) Label(com.googlecode.aviator.code.interpreter.ir.Label) AssertTypeIR(com.googlecode.aviator.code.interpreter.ir.AssertTypeIR) BranchUnlessIR(com.googlecode.aviator.code.interpreter.ir.BranchUnlessIR)

Example 2 with BranchUnlessIR

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

the class InterpretCodeGenerator method onTernaryBoolean.

@Override
public void onTernaryBoolean(final Token<?> lookhead) {
    Label label0 = makeLabel();
    pushLabel0(label0);
    Label label1 = makeLabel();
    pushLabel1(label1);
    this.instruments.add(new BranchUnlessIR(label0, new SourceInfo(this.sourceFile, lookhead.getLineNo())));
    emit(PopIR.INSTANCE);
}
Also used : SourceInfo(com.googlecode.aviator.code.interpreter.ir.SourceInfo) Label(com.googlecode.aviator.code.interpreter.ir.Label) BranchUnlessIR(com.googlecode.aviator.code.interpreter.ir.BranchUnlessIR)

Aggregations

BranchUnlessIR (com.googlecode.aviator.code.interpreter.ir.BranchUnlessIR)2 Label (com.googlecode.aviator.code.interpreter.ir.Label)2 SourceInfo (com.googlecode.aviator.code.interpreter.ir.SourceInfo)2 AssertTypeIR (com.googlecode.aviator.code.interpreter.ir.AssertTypeIR)1