BadScript 2
Loading...
Searching...
No Matches
BadLogicOrExpressionCompiler.cs
Go to the documentation of this file.
2
4
8public class BadLogicOrExpressionCompiler : BadBinaryExpressionCompiler<BadLogicOrExpression>
9{
11 protected override bool EmitLeft => false;
12
14 protected override bool EmitRight => false;
16 public override void CompileBinary(BadExpressionCompileContext context, BadLogicOrExpression expression)
17 {
18 context.Compile(expression.Left);
19 context.Emit(BadOpCode.Dup, expression.Position);
20 int jumpPos = context.EmitEmpty();
21 context.Emit(BadOpCode.Pop, expression.Position);
22 context.Compile(expression.Right);
23 context.ResolveEmpty(jumpPos, BadOpCode.JumpRelativeIfTrue, expression.Position, context.InstructionCount - jumpPos - 1);
24 }
25
26}
BadSourcePosition Position
The source Position of the Expression.
BadExpression Right
Right side of the Expression.
override void CompileBinary(BadExpressionCompileContext context, BadLogicOrExpression expression)
Contains the Logic Expressions for the BadScript2 Language.
BadOpCode
Defines the Operations that the BadVirtualMachine can execute.
Definition BadOpCode.cs:7
void ResolveEmpty(int index, BadOpCode code, BadSourcePosition position, params object[] args)