protected override void DoEmit(EmitContext ec) { ec.BeginBlock(InitBlock); foreach (var s in InitBlock.InitStatements) { s.Emit(ec); } foreach (var s in InitBlock.Statements) { s.Emit(ec); } var endLabel = ec.DefineLabel(); var contLabel = ec.DefineLabel(); ec.EmitLabel(contLabel); ContinueExpression.Emit(ec); ec.EmitCastToBoolean(ContinueExpression.GetEvaluatedCType(ec)); ec.Emit(OpCode.BranchIfFalse, endLabel); LoopBody.Emit(ec); if (NextExpression != null) { NextExpression.Emit(ec); ec.Emit(OpCode.Pop); } ec.Emit(OpCode.Jump, contLabel); ec.EmitLabel(endLabel); ec.EndBlock(); }
protected override void DoEmit(EmitContext initialContext) { initialContext.BeginBlock(InitBlock); foreach (var s in InitBlock.InitStatements) { s.Emit(initialContext); } foreach (var s in InitBlock.Statements) { s.Emit(initialContext); } var nextLabel = initialContext.DefineLabel(); var endLabel = initialContext.DefineLabel(); var ec = initialContext.PushLoop(breakLabel: endLabel, continueLabel: nextLabel); // // Test the condition: // If succeeded then execute the loop body // If failed, goto END // var conditionLabel = ec.DefineLabel(); ec.EmitLabel(conditionLabel); ContinueExpression.Emit(ec); ec.EmitCastToBoolean(ContinueExpression.GetEvaluatedCType(ec)); ec.Emit(OpCode.BranchIfFalse, endLabel); // // Fall through to the loop body // LoopBody.Emit(ec); // // Fall through to the NEXT label // Run the incrementer // Loop back to the condition // ec.EmitLabel(nextLabel); if (NextExpression != null) { NextExpression.Emit(ec); ec.Emit(OpCode.Pop); } ec.Emit(OpCode.Jump, conditionLabel); // // Arrive here when the condition fails // ec.EmitLabel(endLabel); ec.EndBlock(); }
public static ContinueExpression Create( AphidExpressionContext context_aphidExpressionContext, int value_i, int value_i1 ) { ContinueExpression continueExpression = new ContinueExpression(context_aphidExpressionContext); ((AphidExpression)continueExpression).Index = value_i; ((AphidExpression)continueExpression).Length = value_i1; return(continueExpression); // TODO: Edit factory method of ContinueExpression // This method should be able to configure the object in all possible ways. // Add as many parameters as needed, // and assign their values to each field by using the API. }
protected override void DoEmit(EmitContext ec) { InitBlock.Emit(ec); var endLabel = ec.DefineLabel(); var contLabel = ec.DefineLabel(); ec.EmitLabel(contLabel); ContinueExpression.Emit(ec); ec.EmitCastToBoolean(ContinueExpression.GetEvaluatedCType(ec)); ec.Emit(OpCode.BranchIfFalse, endLabel); LoopBody.Emit(ec); NextExpression.Emit(ec); ec.Emit(OpCode.Pop); ec.Emit(OpCode.Jump, contLabel); ec.EmitLabel(endLabel); }
public static void RegisterAll() { BreakExpression.Register(); ContinueExpression.Register(); ReturnFunctionExpression.Register(); AbsFunction.Register(); ExecuteFile.Register(); PowFunction.Register(); ProductFunction.Register(); HelpFunction.Register(); SqrtFunction.Register(); SumDeepFunction.Register(); SumFunction.Register(); LengthFunction.Register(); ConsoleObject.Register(); TrigonometryObject.Register(); ThisConstant.Register(); BooleanValue.Register(); ComplexValue.Register(); DecimalValue.Register(); NullValue.Register(); }
public virtual T Visit(ContinueExpression expression) { return(default(T)); }
public virtual Expression Visit(ContinueExpression expression) { return(expression); }
public int Visit(ContinueExpression expression) { _writer.Write("continue"); return(0); }
public static Result Run(ContinueExpression block, Scope scope) { throw new ContinueException(Interpreters.Execute(block.CountOfLoops, scope).ResultValue.GetLongValue().Clamp(1, 1000)); }