2 instantiations of Scope
Microsoft.CodeAnalysis.CSharp (2)
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (2)
359var rootScope = new Scope(parent: null, boundNode: node, containingFunction: null); 727var newScope = new Scope(parentScope, node, currentFunction);
79 references to Scope
Microsoft.CodeAnalysis.CSharp (79)
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (33)
43public readonly Scope ScopeTree; 51Scope scopeTree, 75var scopeTree = ScopeTreeBuilder.Build( 150var curScope = scope; 357private PooledDictionary<Scope, PooledHashSet<NestedFunction>> CalculateFunctionsCapturingScopeVariables() 359var closuresCapturingScopeVariables = PooledDictionary<Scope, PooledHashSet<NestedFunction>>.GetInstance(); 363var environmentsToScopes = PooledDictionary<ClosureEnvironment, Scope>.GetInstance(); 395var currentScope = scope; 443var bestScope = scope; 444var currentScope = scope; 455var parentScope = currentScope.Parent; 547public static Scope GetVariableDeclarationScope(Scope startingScope, Symbol variable) 554var currentScope = startingScope; 586/// Find the parent <see cref="Scope"/> of the <see cref="Scope"/> corresponding to 589public static Scope GetScopeParent(Scope treeRoot, BoundNode scopeNode) 591var correspondingScope = GetScopeWithMatchingBoundNode(treeRoot, scopeNode); 596/// Finds a <see cref="Scope" /> with a matching <see cref="BoundNode"/> 599public static Scope GetScopeWithMatchingBoundNode(Scope treeRoot, BoundNode node) 603Scope Helper(Scope currentScope) 610foreach (var nestedScope in currentScope.NestedScopes) 612var found = Helper(nestedScope); 627/// A tuple of the found <see cref="NestedFunction"/> and the <see cref="Scope"/> it was found in. 629public static (NestedFunction, Scope) GetVisibleNestedFunction(Scope startingScope, MethodSymbol functionSymbol) 631var currentScope = startingScope; 649public static NestedFunction GetNestedFunctionInTree(Scope treeRoot, MethodSymbol functionSymbol) 653NestedFunction helper(Scope scope) 663foreach (var nestedScope in scope.NestedScopes)
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (45)
32public readonly Scope Parent; 34public readonly ArrayBuilder<Scope> NestedScopes = ArrayBuilder<Scope>.GetInstance(); 79public Scope(Scope parent, BoundNode boundNode, NestedFunction containingFunction) 96foreach (var scope in NestedScopes) 115/// <see cref="Scope"/> tree the only information available is 201public static void VisitNestedFunctions(Scope scope, Action<Scope, NestedFunction> action) 208foreach (var nested in scope.NestedScopes) 218public static bool CheckNestedFunctions(Scope scope, Func<Scope, NestedFunction, bool> func) 228foreach (var nested in scope.NestedScopes) 242public static void VisitScopeTree(Scope treeRoot, Action<Scope> action) 246foreach (var nested in treeRoot.NestedScopes) 253/// Builds a tree of <see cref="Scope"/> nodes corresponding to a given method. 257/// <see cref="Scope"/> tree. 259/// At the same time it sets <see cref="Scope.CanMergeWithParent"/> 262/// after the beginning of a <see cref="Scope"/>, to a <see cref="BoundLabelStatement"/> 263/// before the start of the scope, but after the start of <see cref="Scope.Parent"/>. 276private Scope _currentScope; 289private readonly SmallDictionary<Symbol, Scope> _localToScope = new SmallDictionary<Symbol, Scope>(); 320private readonly PooledDictionary<LabelSymbol, ArrayBuilder<Scope>> _scopesAfterLabel = PooledDictionary<LabelSymbol, ArrayBuilder<Scope>>.GetInstance(); 332Scope rootScope, 349public static Scope Build( 359var rootScope = new Scope(parent: null, boundNode: node, containingFunction: null); 400var oldScope = _currentScope; 409var oldScope = _currentScope; 418var oldScope = _currentScope; 506_scopesAfterLabel.Add(node.Label, ArrayBuilder<Scope>.GetInstance()); 525/// This is where we calculate <see cref="Scope.CanMergeWithParent"/>. 526/// <see cref="Scope.CanMergeWithParent"/> is always true unless we jump from after 536foreach (var scope in scopesAfterLabel) 569var oldScope = _currentScope; 620var scope = _currentScope; 643if (_localToScope.TryGetValue(symbol, out var declScope)) 712var scope = CreateNestedScope(_currentScope, _currentFunction); 723Scope CreateNestedScope(Scope parentScope, NestedFunction currentFunction) 727var newScope = new Scope(parentScope, node, currentFunction); 735/// or is the <see cref="Scope.Parent"/> of <see cref="_currentScope"/>. 740private void PopScope(Scope scope) 766private void DeclareLocals<TSymbol>(Scope scope, ImmutableArray<TSymbol> locals, bool declareAsFree = false)
Lowering\ClosureConversion\ClosureConversion.cs (1)
358SynthesizedClosureEnvironment MakeFrame(Analysis.Scope scope, Analysis.ClosureEnvironment env)