Search in sources :

Example 6 with Label

use of com.googlecode.aviator.code.interpreter.ir.Label 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 7 with Label

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

the class InterpretCodeGenerator method onTernaryRight.

@Override
public void onTernaryRight(final Token<?> lookhead) {
    Label label1 = popLabel1();
    visitLabel(label1);
}
Also used : Label(com.googlecode.aviator.code.interpreter.ir.Label)

Example 8 with Label

use of com.googlecode.aviator.code.interpreter.ir.Label 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

Label (com.googlecode.aviator.code.interpreter.ir.Label)8 AssertTypeIR (com.googlecode.aviator.code.interpreter.ir.AssertTypeIR)5 SourceInfo (com.googlecode.aviator.code.interpreter.ir.SourceInfo)4 BranchUnlessIR (com.googlecode.aviator.code.interpreter.ir.BranchUnlessIR)3 BranchIfIR (com.googlecode.aviator.code.interpreter.ir.BranchIfIR)2 GotoIR (com.googlecode.aviator.code.interpreter.ir.GotoIR)2 ClearIR (com.googlecode.aviator.code.interpreter.ir.ClearIR)1 JumpIR (com.googlecode.aviator.code.interpreter.ir.JumpIR)1 LoadIR (com.googlecode.aviator.code.interpreter.ir.LoadIR)1 NewLambdaIR (com.googlecode.aviator.code.interpreter.ir.NewLambdaIR)1 OperatorIR (com.googlecode.aviator.code.interpreter.ir.OperatorIR)1 PopIR (com.googlecode.aviator.code.interpreter.ir.PopIR)1 SendIR (com.googlecode.aviator.code.interpreter.ir.SendIR)1 VisitLabelIR (com.googlecode.aviator.code.interpreter.ir.VisitLabelIR)1 IdentityHashMap (java.util.IdentityHashMap)1