// ForStmt public override bool Walk(ForStatement node) { // Walk the expression if (node.List != null) { node.List.Walk(this); } BitArray opte = new BitArray(_bits); BitArray exit = new BitArray(_bits.Length, true); PushLoop(exit); // Define the lhs node.Left.Walk(_fdef); 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; }
//for_stmt: 'for' target_list 'in' expression_list ':' suite ['else' ':' suite] private Statement ParseForStmt() { Eat(TokenKind.KeywordFor); string forWhiteSpace = _tokenWhiteSpace; var start = GetStart(); 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_); 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) { 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) { node.Body.Walk(this); } if (node.Else != null) { node.Else.Walk(this); } return false; }
// ForStatement public override bool Walk(ForStatement node) { return ShouldWalkWorker(node); }
public override void PostWalk(ForStatement node) { PostWalkWorker(node); }
public override bool Walk(ForStatement node) { WalkLoop(node.Body, node.Else); return false; }
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; }