2 instantiations of Scope
Microsoft.CodeAnalysis.CSharp (2)
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (2)
377
var rootScope = new
Scope
(parent: null, boundNode: node, containingFunction: null);
747
var newScope = new
Scope
(parentScope, node, currentFunction);
79 references to Scope
Microsoft.CodeAnalysis.CSharp (79)
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (33)
46
public readonly
Scope
ScopeTree;
54
Scope
scopeTree,
79
var
scopeTree = ScopeTreeBuilder.Build(
154
var
curScope = scope;
362
private PooledDictionary<
Scope
, PooledHashSet<NestedFunction>> CalculateFunctionsCapturingScopeVariables()
364
var closuresCapturingScopeVariables = PooledDictionary<
Scope
, PooledHashSet<NestedFunction>>.GetInstance();
368
var environmentsToScopes = PooledDictionary<ClosureEnvironment,
Scope
>.GetInstance();
400
var
currentScope = scope;
448
var
bestScope = scope;
449
var
currentScope = scope;
460
var
parentScope = currentScope.Parent;
567
public static
Scope
GetVariableDeclarationScope(
Scope
startingScope, Symbol variable)
574
var
currentScope = startingScope;
606
/// Find the parent <see cref="
Scope
"/> of the <see cref="
Scope
"/> corresponding to
609
public static
Scope
GetScopeParent(
Scope
treeRoot, BoundNode scopeNode)
611
var
correspondingScope = GetScopeWithMatchingBoundNode(treeRoot, scopeNode);
616
/// Finds a <see cref="
Scope
" /> with a matching <see cref="BoundNode"/>
619
public static
Scope
GetScopeWithMatchingBoundNode(
Scope
treeRoot, BoundNode node)
623
Scope
Helper(
Scope
currentScope)
630
foreach (
var
nestedScope in currentScope.NestedScopes)
632
var
found = Helper(nestedScope);
647
/// A tuple of the found <see cref="NestedFunction"/> and the <see cref="
Scope
"/> it was found in.
649
public static (NestedFunction,
Scope
) GetVisibleNestedFunction(
Scope
startingScope, MethodSymbol functionSymbol)
651
var
currentScope = startingScope;
669
public static NestedFunction GetNestedFunctionInTree(
Scope
treeRoot, MethodSymbol functionSymbol)
673
NestedFunction helper(
Scope
scope)
683
foreach (
var
nestedScope in scope.NestedScopes)
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (45)
33
public readonly
Scope
Parent;
35
public readonly ArrayBuilder<
Scope
> NestedScopes = ArrayBuilder<
Scope
>.GetInstance();
80
public Scope(
Scope
parent, BoundNode boundNode, NestedFunction containingFunction)
97
foreach (
var
scope in NestedScopes)
116
/// <see cref="
Scope
"/> tree the only information available is
219
public static void VisitNestedFunctions(
Scope
scope, Action<
Scope
, NestedFunction> action)
226
foreach (
var
nested in scope.NestedScopes)
236
public static bool CheckNestedFunctions(
Scope
scope, Func<
Scope
, NestedFunction, bool> func)
246
foreach (
var
nested in scope.NestedScopes)
260
public static void VisitScopeTree(
Scope
treeRoot, Action<
Scope
> action)
264
foreach (
var
nested in treeRoot.NestedScopes)
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"/>.
294
private
Scope
_currentScope;
307
private readonly SmallDictionary<Symbol,
Scope
> _localToScope = new SmallDictionary<Symbol,
Scope
>();
338
private readonly PooledDictionary<LabelSymbol, ArrayBuilder<
Scope
>> _scopesAfterLabel = PooledDictionary<LabelSymbol, ArrayBuilder<
Scope
>>.GetInstance();
350
Scope
rootScope,
367
public static
Scope
Build(
377
var
rootScope = new Scope(parent: null, boundNode: node, containingFunction: null);
418
var
oldScope = _currentScope;
427
var
oldScope = _currentScope;
436
var
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
555
foreach (
var
scope in scopesAfterLabel)
588
var
oldScope = _currentScope;
639
var
scope = _currentScope;
662
if (_localToScope.TryGetValue(symbol, out
var
declScope))
732
var
scope = CreateNestedScope(_currentScope, _currentFunction);
743
Scope
CreateNestedScope(
Scope
parentScope, NestedFunction currentFunction)
747
var
newScope = new Scope(parentScope, node, currentFunction);
755
/// or is the <see cref="
Scope
.Parent"/> of <see cref="_currentScope"/>.
760
private void PopScope(
Scope
scope)
786
private void DeclareLocals<TSymbol>(
Scope
scope, ImmutableArray<TSymbol> locals, bool declareAsFree = false)
Lowering\ClosureConversion\ClosureConversion.cs (1)
368
SynthesizedClosureEnvironment MakeFrame(Analysis.
Scope
scope, Analysis.ClosureEnvironment env)