public void AddInstructions(LightCompiler compiler) { EnterLoopInstruction enterLoopInstruction = null; compiler.PushLabelBlock(LabelScopeKind.Statement); foreach (Expression expression in this._exprs) { compiler.CompileAsVoid(expression); EnterLoopExpression expression2 = expression as EnterLoopExpression; if (expression2 != null) { enterLoopInstruction = expression2.EnterLoopInstruction; } } compiler.PopLabelBlock(LabelScopeKind.Statement); if (enterLoopInstruction != null) { enterLoopInstruction.FinishLoop(compiler.Instructions.Count); } }
public void AddInstructions(LightCompiler compiler) { EnterLoopInstruction enterLoop = null; compiler.PushLabelBlock(LabelScopeKind.Statement); // emit loop body: foreach (var expr in _exprs) { compiler.CompileAsVoid(expr); var enterLoopExpression = expr as EnterLoopExpression; if (enterLoopExpression != null) { enterLoop = enterLoopExpression.EnterLoopInstruction; } } compiler.PopLabelBlock(LabelScopeKind.Statement); // If enterLoop is null, we will never JIT compile the loop. if (enterLoop != null) { enterLoop.FinishLoop(compiler.Instructions.Count); } }