public void ProcessStatementForRange(DMASTProcStatementForRange statementForRange) { DMExpression.Emit(_dmObject, _proc, statementForRange.RangeStart); DMExpression.Emit(_dmObject, _proc, statementForRange.RangeEnd); DMExpression.Emit(_dmObject, _proc, statementForRange.Step); _proc.CreateRangeEnumerator(); _proc.StartScope(); { if (statementForRange.Initializer != null) { ProcessStatement(statementForRange.Initializer); } string loopLabel = _proc.NewLabelName(); _proc.LoopStart(loopLabel); { DMExpression outputVariable = DMExpression.Create(_dmObject, _proc, statementForRange.Variable); (DMReference outputRef, _) = outputVariable.EmitReference(_dmObject, _proc); _proc.Enumerate(outputRef); _proc.BreakIfFalse(); ProcessBlockInner(statementForRange.Body); _proc.LoopContinue(loopLabel); _proc.LoopJumpToStart(loopLabel); } _proc.LoopEnd(); } _proc.EndScope(); _proc.DestroyEnumerator(); }
public void VisitProcStatementForRange(DMASTProcStatementForRange statementForRange) { SimplifyExpression(ref statementForRange.RangeStart); SimplifyExpression(ref statementForRange.RangeEnd); SimplifyExpression(ref statementForRange.Step); statementForRange.Initializer?.Visit(this); statementForRange.Body?.Visit(this); }
public void VisitProcStatementForRange(DMASTProcStatementForRange statementForRange) { SimplifyExpression(ref statementForRange.RangeStart); SimplifyExpression(ref statementForRange.RangeEnd); SimplifyExpression(ref statementForRange.Step); if (statementForRange.Initializer != null) { statementForRange.Initializer.Visit(this); } if (statementForRange.Body != null) { statementForRange.Body.Visit(this); } }