BadScript 2
Loading...
Searching...
No Matches
BadTernaryExpressionCompiler.cs
Go to the documentation of this file.
2
4
8public class BadTernaryExpressionCompiler : BadExpressionCompiler<BadTernaryExpression>
9{
11 public override void Compile(BadExpressionCompileContext context, BadTernaryExpression expression)
12 {
13 context.Compile(expression.Left);
14 int jIfFalse = context.EmitEmpty();
15 context.Compile(expression.TrueRet);
16 int jEnd = context.EmitEmpty();
17 context.ResolveEmpty(jIfFalse, BadOpCode.JumpRelativeIfFalse, expression.Position, context.InstructionCount - jIfFalse - 1);
18 context.Compile(expression.FalseRet);
19 context.ResolveEmpty(jEnd, BadOpCode.JumpRelative, expression.Position, context.InstructionCount - jEnd - 1);
20 }
21}
Implements the Ternary Expression LEFT ? TRUE_RET : FALSE_RET.
BadExpression Left
Left side that will be evaluated.
BadExpression FalseRet
Expression that is executed if left evaluates to false.
BadExpression TrueRet
Expression that is executed if left evaluates to true.
BadSourcePosition Position
The source Position of the Expression.
override void Compile(BadExpressionCompileContext context, BadTernaryExpression expression)
Contains the Access 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)