public virtual Statement VisitFor(For For) { if (For == null) return null; For.Initializer = this.VisitStatementList(For.Initializer); For.Invariants = this.VisitLoopInvariantList(For.Invariants); For.Condition = this.VisitExpression(For.Condition); For.Incrementer = this.VisitStatementList(For.Incrementer); For.Body = this.VisitBlock(For.Body); return For; }
public override Statement VisitFor(For For) { if (For == null) return null; return base.VisitFor((For)For.Clone()); }
public override Statement VisitFor(For For) { WriteLine("for ("); In(); if (((StatementList)For.Initializer).Count > 0) this.VisitStatementList(For.Initializer); else WriteLine(";"); WriteStart(string.Empty); this.VisitExpression(For.Condition); WriteFinish(";"); this.processingForIncrementers = true; WriteStart(string.Empty); this.VisitStatementList(For.Incrementer); this.processingForIncrementers = false; Out(); WriteLine(")"); this.VisitBlock(For.Body); return For; }
private Block ParseFor(TokenSet followers){ For For = new For(); For.SourceContext = this.scanner.CurrentSourceContext; Debug.Assert(this.currentToken == Token.For); this.GetNextToken(); SourceContext sctx = this.scanner.CurrentSourceContext; this.Skip(Token.LeftParenthesis); TokenSet followersOrRightParenthesisOrSemicolon = followers|Parser.RightParenthesisOrSemicolon; For.Initializer = this.ParseForInitializer(followersOrRightParenthesisOrSemicolon); For.Condition = this.currentToken == Token.Semicolon ? null : this.ParseExpression(followersOrRightParenthesisOrSemicolon); this.Skip(Token.Semicolon); For.Incrementer = this.ParseForIncrementer(followers|Token.RightParenthesis); this.ParseBracket(sctx, Token.RightParenthesis, followers|Parser.StatementStart, Error.ExpectedRightParenthesis); For.SourceContext.EndPos = this.scanner.endPos; For.Invariants = ParseLoopInvariants(followers); SourceContext savedCompoundStatementOpeningContext = this.compoundStatementOpeningContext; For.SourceContext.EndPos = this.scanner.endPos; this.compoundStatementOpeningContext = For.SourceContext; Block b = this.ParseStatementAsBlock(followers); For.Body = b; if (b != null) For.SourceContext.EndPos = b.SourceContext.EndPos; this.compoundStatementOpeningContext = savedCompoundStatementOpeningContext; StatementList statements = new StatementList(1); statements.Add(For); return new Block(statements, For.SourceContext, this.insideCheckedBlock, this.insideUncheckedBlock, this.inUnsafeCode); }
public EventingVisitor(Action<For> visitFor) { VisitedFor += visitFor; } public event Action<For> VisitedFor; public override Statement VisitFor(For For) { if (VisitedFor != null) VisitedFor(For); return base.VisitFor(For); }