private bool WalkIterators(Comprehension node) { if (node.Iterators != null) { foreach (ComprehensionIterator ci in node.Iterators) { ci.Walk(this); } } return false; }
public ComprehensionScope(AnalysisValue comprehensionResult, Comprehension comprehension, InterpreterScope outerScope) : base(comprehensionResult, comprehension, outerScope) { }
private ComprehensionScope MakeDictComprehensionScope(Comprehension node) { var unit = new DictionaryComprehensionAnalysisUnit(node, _tree, _curUnit, _scope); unit.Enqueue(); return (ComprehensionScope)unit.Scope; }
private ComprehensionScope MakeGeneratorComprehensionScope(Comprehension node) { var unit = new GeneratorComprehensionAnalysisUnit(node, _tree, _curUnit, _scope); unit.Enqueue(); return (ComprehensionScope)unit.Scope; }
/// <summary> /// Makes sure we create a scope for a comprehension (generator, set, dict, or list comprehension in 3.x) where /// the variables which are assigned will be stored. /// </summary> private void EnsureComprehensionScope(Comprehension node, Func<Comprehension, ComprehensionScope> makeScope) { InterpreterScope scope, declScope = _scope; if (!declScope.TryGetNodeScope(node, out scope)) { scope = makeScope(node); declScope.AddNodeScope(node, scope); declScope.Children.Add(scope); } _scope = scope; }