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