Search in sources :

Example 1 with AssertTypeIR

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

the class InterpretCodeGenerator method onJoinLeft.

@Override
public void onJoinLeft(final Token<?> lookhead) {
    if (!OperationRuntime.containsOpFunction(this.compileEnv, OperatorType.AND)) {
        emit(new AssertTypeIR(AssertTypes.Bool));
        Label label = makeLabel();
        pushLabel0(label);
        this.instruments.add(new BranchIfIR(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) BranchIfIR(com.googlecode.aviator.code.interpreter.ir.BranchIfIR)

Example 2 with AssertTypeIR

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

the class InterpretCodeGenerator method onJoinRight.

@Override
public void onJoinRight(final Token<?> lookhead) {
    if (!OperationRuntime.containsOpFunction(this.compileEnv, OperatorType.AND)) {
        emit(new AssertTypeIR(AssertTypes.Bool));
        Label label = popLabel0();
        visitLabel(label);
    } else {
        emit(OperatorIR.OR);
    }
}
Also used : Label(com.googlecode.aviator.code.interpreter.ir.Label) AssertTypeIR(com.googlecode.aviator.code.interpreter.ir.AssertTypeIR)

Example 3 with AssertTypeIR

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

the class InterpretCodeGenerator method onAndRight.

@Override
public void onAndRight(final Token<?> lookhead) {
    if (!OperationRuntime.containsOpFunction(this.compileEnv, OperatorType.AND)) {
        emit(new AssertTypeIR(AssertTypes.Bool));
        Label label = popLabel0();
        visitLabel(label);
    } else {
        emit(OperatorIR.AND);
    }
}
Also used : Label(com.googlecode.aviator.code.interpreter.ir.Label) AssertTypeIR(com.googlecode.aviator.code.interpreter.ir.AssertTypeIR)

Example 4 with AssertTypeIR

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

Aggregations

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