// WithStatement public override bool Walk(WithStatement node) { node.Parent = _currentScope; _currentScope.ContainsExceptionHandling = true; if (node.Variable != null) { node.Variable.Walk(_define); } return(true); }
// WithStatement public override bool Walk(WithStatement node) { _currentScope.ContainsExceptionHandling = true; for (int i = 0; i < node.Items.Count; i++) { if (node.Items[i].Variable != null) { node.Items[i].Variable.Walk(_define); } } return(true); }
// WithStmt public override bool Walk(WithStatement node) { // Walk the expression node.ContextManager.Walk(this); BitArray save = _bits; _bits = new BitArray(_bits); // Define the Rhs if (node.Variable != null) { node.Variable.Walk(_fdef); } // Flow the body node.Body.Walk(this); _bits = save; return(false); }
public override bool Walk(WithStatement node) { CanComplete = true; CommitByDefault = true; if (node.Items != null) { var item = node.Items.LastOrDefault(); if (item != null) { if (item.Variable != null) { CanComplete = false; } else { item.Walk(this); } } } if (node.Body != null) { node.Body.Walk(this); } return false; }
//with_stmt: 'with' with_item (',' with_item)* ':' suite //with_item: test ['as' expr] private WithStatement ParseWithStmt(bool isAsync) { var start = isAsync ? GetStart() : 0; Eat(TokenKind.KeywordWith); if (!isAsync) { start = GetStart(); } string withWhiteSpace = _tokenWhiteSpace; var itemWhiteSpace = MakeWhiteSpaceList(); List<WithItem> items = new List<WithItem>(); items.Add(ParseWithItem(itemWhiteSpace)); while (MaybeEat(TokenKind.Comma)) { if (itemWhiteSpace != null) { itemWhiteSpace.Add(_tokenWhiteSpace); } items.Add(ParseWithItem(itemWhiteSpace)); } var header = GetEnd(); Statement body = ParseSuite(); WithStatement ret = new WithStatement(items.ToArray(), body, isAsync); if (_verbatim) { AddPreceedingWhiteSpace(ret, withWhiteSpace); AddListWhiteSpace(ret, itemWhiteSpace.ToArray()); } ret.SetLoc(start, body.EndIndex); return ret; }
public override bool Walk(WithStatement node) { if (node.IsAsync) { AddSpan(Tuple.Create("", new Span(node.StartIndex, 5)), PredefinedClassificationTypeNames.Keyword); } return base.Walk(node); }
// WithStatement public override bool Walk(WithStatement node) { _currentScope.ContainsExceptionHandling = true; for (int i = 0; i < node.Items.Count; i++) { if (node.Items[i].Variable != null) { node.Items[i].Variable.Walk(_define); } } return true; }
public override bool Walk(WithStatement node) { UpdateLineInfo(node); return base.Walk(node); }
public override bool Walk(WithStatement node) { UpdateChildRanges(node); foreach (var item in node.Items) { var assignTo = item.Variable as NameExpression; if (assignTo != null) { _scope.AddVariable(assignTo.Name, CreateVariableInDeclaredScope(assignTo)); } } return base.Walk(node); }
public override bool Walk(WithStatement node) { foreach (var item in node.Items) { if (item.Variable != null) { item.Variable.Walk(Define); } if (item.ContextManager != null) { item.ContextManager.Walk(this); } } if (node.Body != null) { node.Body.Walk(this); } return false; }
// WithStmt public override bool Walk(WithStatement node) { BitArray save = _bits; _bits = new BitArray(_bits); // Walk the expression for (int i = 0; i < node.Items.Count; i++) { node.Items[i].ContextManager.Walk(this); // Define the Rhs if (node.Items[i].Variable != null) { node.Items[i].Variable.Walk(_fdef); } } // Flow the body node.Body.Walk(this); _bits = save; return false; }
public override void PostWalk(WithStatement node) { PostWalkWorker(node); }
// WithStatement public override bool Walk(WithStatement node) { return ShouldWalkWorker(node); }
public override bool Walk(WithStatement node) { AddTagIfNecessary(node); return base.Walk(node); }