public override bool Walk(ForStatement node) { if (node.Left != null) { node.Left.Walk(Define); } if (node.List != null) { node.List.Walk(this); } if (node.Body != null) { node.Body.Walk(this); } if (node.Else != null) { node.Else.Walk(this); } return false; }
public override bool Walk(ForStatement node) { // Walk for statements manually so we don't traverse the list. // This prevents the list and/or left from being collapsed ever. if (node.Body != null) { AddTagIfNecessary( node.StartIndex, node.Body.EndIndex, _ast.GetLineEndFromPosition(node.StartIndex) ); node.Body.Walk(this); } if (node.Else != null) { AddTagIfNecessary(node.Else, node.ElseIndex); node.Else.Walk(this); } return false; }
public override bool Walk(ForStatement node) { if (!IsActualExpression(node.Left) || HasCaret(node.Left)) { CanComplete = false; CommitByDefault = false; } else if (IsActualExpression(node.List)) { CanComplete = true; CommitByDefault = true; node.List.Walk(this); } return false; }
//for_stmt: 'for' target_list 'in' expression_list ':' suite ['else' ':' suite] private Statement ParseForStmt(bool isAsync) { var start = isAsync ? GetStart() : 0; Eat(TokenKind.KeywordFor); if (!isAsync) { start = GetStart(); } string forWhiteSpace = _tokenWhiteSpace; bool trailingComma; List<string> listWhiteSpace; List<Expression> l = ParseExpressionList(out trailingComma, out listWhiteSpace); // expr list is something like: // () // a // a,b // a,b,c // we either want just () or a or we want (a,b) and (a,b,c) // so we can do tupleExpr.EmitSet() or loneExpr.EmitSet() string inWhiteSpace = null, elseWhiteSpace = null; Expression lhs = MakeTupleOrExpr(l, listWhiteSpace, trailingComma, true); Expression list; Statement body, else_; bool incomplete = false; int header; string newlineWhiteSpace = ""; int end; if ((lhs is ErrorExpression && MaybeEatNewLine(out newlineWhiteSpace)) || !Eat(TokenKind.KeywordIn)) { // error handling else_ = null; end = header = GetEnd(); list = null; body = null; lhs = Error(newlineWhiteSpace, lhs); incomplete = true; } else { inWhiteSpace = _tokenWhiteSpace; list = ParseTestListAsExpr(); header = GetEnd(); body = ParseLoopSuite(); else_ = null; end = body.EndIndex; if (MaybeEat(TokenKind.KeywordElse)) { elseWhiteSpace = _tokenWhiteSpace; else_ = ParseSuite(); end = else_.EndIndex; } } ForStatement ret = new ForStatement(lhs, list, body, else_, isAsync); if (_verbatim) { AddPreceedingWhiteSpace(ret, forWhiteSpace); if (inWhiteSpace != null) { AddSecondPreceedingWhiteSpace(ret, inWhiteSpace); } if (elseWhiteSpace != null) { AddThirdPreceedingWhiteSpace(ret, elseWhiteSpace); } if (incomplete) { AddErrorIsIncompleteNode(ret); } } ret.HeaderIndex = header; ret.SetLoc(start, end); return ret; }
public override bool Walk(ForStatement node) { if (node.IsAsync) { AddSpan(Tuple.Create("", new Span(node.StartIndex, 5)), PredefinedClassificationTypeNames.Keyword); } return base.Walk(node); }
// ForEachStatement public override bool Walk(ForStatement node) { // we only push the loop for the body of the loop // so we need to walk the for statement ourselves node.Left.Walk(_define); if (node.Left != null) { node.Left.Walk(this); } if (node.List != null) { node.List.Walk(this); } if (node.Body != null) { node.Body.Walk(this); } if (node.Else != null) { node.Else.Walk(this); } return false; }
public override bool Walk(ForStatement node) { UpdateLineInfo(node.List); AddBlock(); if (node.Body != null) { node.Body.Walk(this); } if (node.Else != null) { AddBlock(); node.Else.Walk(this); } AddBlock(); return false; }
public override bool Walk(ForStatement node) { UpdateChildRanges(node); return base.Walk(node); }
public override bool Walk(ForStatement node) { if (node.Left != null) { node.Left.Walk(Define); } if (node.List != null) { node.List.Walk(this); } if (node.Body != null) { bool oldInLoop = _inLoop; _inLoop = true; node.Body.Walk(this); _inLoop = oldInLoop; } if (node.Else != null) { node.Else.Walk(this); } return false; }
public override bool Walk(ForStatement node) { return false; }
public override bool Walk(ForStatement node) { WalkLoop(node.Body, node.Else); return false; }
// ForStmt public override bool Walk(ForStatement node) { // Walk the expression if (node.List != null) { node.List.Walk(this); } node.Left.Walk(_fdef); BitArray opte = new BitArray(_bits); BitArray exit = new BitArray(_bits.Length, true); PushLoop(exit); // Define the lhs if (node.Body != null) { // Walk the body node.Body.Walk(this); } PopLoop(); _bits.And(exit); if (node.Else != null) { // Flow the else BitArray save = _bits; _bits = opte; node.Else.Walk(this); // Restore the bits _bits = save; } // Intersect _bits.And(opte); return false; }
public override void PostWalk(ForStatement node) { PostWalkWorker(node); }
// ForStatement public override bool Walk(ForStatement node) { return ShouldWalkWorker(node); }