BadScript 2
Loading...
Searching...
No Matches
BadLockExpressionCompiler.cs
Go to the documentation of this file.
2
4
8public class BadLockExpressionCompiler : BadExpressionCompiler<BadLockExpression>
9{
11 public override void Compile(BadExpressionCompileContext context, BadLockExpression expression)
12 {
13 context.Compile(expression.LockExpression);
14 context.Emit(BadOpCode.Dup, expression.Position);
15
16 if (expression.Block.Any()) // Dont aquire lock if there are no expressions in the block
17 {
18 context.Emit(BadOpCode.AquireLock, expression.Position);
19 context.Compile(expression.Block);
20 context.Emit(BadOpCode.ReleaseLock, expression.Position);
21 }
22 }
23}
BadSourcePosition Position
The source Position of the Expression.
readonly BadExpression LockExpression
The Expression to lock on.
IEnumerable< BadExpression > Block
The Block Body.
override void Compile(BadExpressionCompileContext context, BadLockExpression expression)
Contains the Locking Expressions for the BadScript2 Language.
BadOpCode
Defines the Operations that the BadVirtualMachine can execute.
Definition BadOpCode.cs:7