public override bool Walk(ForNode node) { if (node != null) { if (node.Initializer != null) { // if the variable portion of the for-in statement is a lexical // declaration, then we will create the block node for its body right now // and add the declaration. This will prevent the body from both creating // a new lexical scope and from deleting an empty one. var lexDeclaration = node.Initializer as LexicalDeclaration; if (lexDeclaration != null) { // create the scope on the block SetScope( node, new BlockScope(node, CurrentLexicalScope, _errorSink) { IsInWithScope = m_withDepth > 0 } ); m_lexicalStack.Push(GetScope(node)); } } try { if (node.Initializer != null) { node.Initializer.Walk(this); } if (node.Condition != null) { node.Condition.Walk(this); } if (node.Body != null) { node.Body.Walk(this); } if (node.Incrementer != null) { node.Incrementer.Walk(this); } } finally { if (GetScope(node) != null) { Debug.Assert(CurrentLexicalScope == GetScope(node)); m_lexicalStack.Pop(); } } } return(false); }
public override bool Walk(ForNode node) { ReplaceControlFlowWhiteSpace(node, "for".Length); if (node.Initializer != null) { ReplacePreceedingWhiteSpace( node.Initializer.GetStartIndex(_tree.LocationResolver), _options.SpaceAfterOpeningAndBeforeClosingNonEmptyParenthesis ? " " : "", _openParen ); node.Initializer.Walk(this); } if (node.Condition != null) { ReplacePreceedingWhiteSpace( node.Condition.GetStartIndex(_tree.LocationResolver), _options.SpaceAfterSemiColonInFor ? " " : "", _semicolon ); node.Condition.Walk(this); } if (node.Incrementer != null) { ReplacePreceedingWhiteSpace(node.Incrementer.GetStartIndex(_tree.LocationResolver), _options.SpaceAfterSemiColonInFor ? " " : "", _semicolon); node.Incrementer.Walk(this); ReplaceFollowingWhiteSpace( node.Incrementer.GetEndIndex(_tree.LocationResolver), _options.SpaceAfterOpeningAndBeforeClosingNonEmptyParenthesis ? " " : "" ); } if (node.HeaderEnd != -1) { WalkFlowControlBlockWithOptionalParens(node.Body, node.HeaderEnd, false); } return false; }
public override bool Walk(ForNode node) { UpdateChildRanges(node); return base.Walk(node); }
public override bool Walk(ForNode node) { AddNode(node); return true; }
public override bool Walk(ForNode node) { if (node != null) { if (node.Initializer != null) { // if the variable portion of the for-in statement is a lexical // declaration, then we will create the block node for its body right now // and add the declaration. This will prevent the body from both creating // a new lexical scope and from deleting an empty one. var lexDeclaration = node.Initializer as LexicalDeclaration; if (lexDeclaration != null) { // create the scope on the block SetScope( node, new BlockScope(node, CurrentLexicalScope, _errorSink) { IsInWithScope = m_withDepth > 0 } ); m_lexicalStack.Push(GetScope(node)); } } try { if (node.Initializer != null) { node.Initializer.Walk(this); } if (node.Condition != null) { node.Condition.Walk(this); } if (node.Body != null) { node.Body.Walk(this); } if (node.Incrementer != null) { node.Incrementer.Walk(this); } } finally { if (GetScope(node) != null) { Debug.Assert(CurrentLexicalScope == GetScope(node)); m_lexicalStack.Pop(); } } } return false; }
public override bool Walk(ForNode node) { if (CheckBlock(node.Body)) { Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver); return false; } return base.Walk(node); }