2 instantiations of Scope
Microsoft.CodeAnalysis.CSharp (2)
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (2)
377var rootScope = new Scope(parent: null, boundNode: node, containingFunction: null); 747var newScope = new Scope(parentScope, node, currentFunction);
67 references to Scope
Microsoft.CodeAnalysis.CSharp (67)
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (27)
45public readonly Scope ScopeTree; 53Scope scopeTree, 78var scopeTree = ScopeTreeBuilder.Build( 153var curScope = scope; 361private PooledDictionary<Scope, PooledHashSet<NestedFunction>> CalculateFunctionsCapturingScopeVariables() 363var closuresCapturingScopeVariables = PooledDictionary<Scope, PooledHashSet<NestedFunction>>.GetInstance(); 367var environmentsToScopes = PooledDictionary<ClosureEnvironment, Scope>.GetInstance(); 566public static Scope GetVariableDeclarationScope(Scope startingScope, Symbol variable) 573var currentScope = startingScope; 605/// Find the parent <see cref="Scope"/> of the <see cref="Scope"/> corresponding to 608public static Scope GetScopeParent(Scope treeRoot, BoundNode scopeNode) 610var correspondingScope = GetScopeWithMatchingBoundNode(treeRoot, scopeNode); 615/// Finds a <see cref="Scope" /> with a matching <see cref="BoundNode"/> 618public static Scope GetScopeWithMatchingBoundNode(Scope treeRoot, BoundNode node) 622Scope Helper(Scope currentScope) 631var found = Helper(nestedScope); 646/// A tuple of the found <see cref="NestedFunction"/> and the <see cref="Scope"/> it was found in. 648public static (NestedFunction, Scope) GetVisibleNestedFunction(Scope startingScope, MethodSymbol functionSymbol) 650var currentScope = startingScope; 668public static NestedFunction GetNestedFunctionInTree(Scope treeRoot, MethodSymbol functionSymbol) 672NestedFunction helper(Scope scope)
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (39)
33public readonly Scope Parent; 35public readonly ArrayBuilder<Scope> NestedScopes = ArrayBuilder<Scope>.GetInstance(); 80public Scope(Scope parent, BoundNode boundNode, NestedFunction containingFunction) 116/// <see cref="Scope"/> tree the only information available is 219public static void VisitNestedFunctions(Scope scope, Action<Scope, NestedFunction> action) 236public static bool CheckNestedFunctions(Scope scope, Func<Scope, NestedFunction, bool> func) 260public static void VisitScopeTree(Scope treeRoot, Action<Scope> action) 271/// Builds a tree of <see cref="Scope"/> nodes corresponding to a given method. 275/// <see cref="Scope"/> tree. 277/// At the same time it sets <see cref="Scope.CanMergeWithParent"/> 280/// after the beginning of a <see cref="Scope"/>, to a <see cref="BoundLabelStatement"/> 281/// before the start of the scope, but after the start of <see cref="Scope.Parent"/>. 294private Scope _currentScope; 307private readonly SmallDictionary<Symbol, Scope> _localToScope = new SmallDictionary<Symbol, Scope>(); 338private readonly PooledDictionary<LabelSymbol, ArrayBuilder<Scope>> _scopesAfterLabel = PooledDictionary<LabelSymbol, ArrayBuilder<Scope>>.GetInstance(); 350Scope rootScope, 367public static Scope Build( 377var rootScope = new Scope(parent: null, boundNode: node, containingFunction: null); 418var oldScope = _currentScope; 427var oldScope = _currentScope; 436var oldScope = _currentScope; 525_scopesAfterLabel.Add(node.Label, ArrayBuilder<Scope>.GetInstance()); 544/// This is where we calculate <see cref="Scope.CanMergeWithParent"/>. 545/// <see cref="Scope.CanMergeWithParent"/> is always true unless we jump from after 588var oldScope = _currentScope; 639var scope = _currentScope; 732var scope = CreateNestedScope(_currentScope, _currentFunction); 743Scope CreateNestedScope(Scope parentScope, NestedFunction currentFunction) 747var newScope = new Scope(parentScope, node, currentFunction); 755/// or is the <see cref="Scope.Parent"/> of <see cref="_currentScope"/>. 760private void PopScope(Scope scope) 786private void DeclareLocals<TSymbol>(Scope scope, ImmutableArray<TSymbol> locals, bool declareAsFree = false)
Lowering\ClosureConversion\ClosureConversion.cs (1)
363SynthesizedClosureEnvironment MakeFrame(Analysis.Scope scope, Analysis.ClosureEnvironment env)