public void SetAmbient(IScopeInternal scope, ScopeContext context = null) { // clear all SetHttpContextObject(ScopeItemKey, null, false); SetHttpContextObject(ScopeRefItemKey, null, false); SetCallContextObject(ScopeItemKey, null); SetHttpContextObject(ContextItemKey, null, false); SetCallContextObject(ContextItemKey, null); if (scope == null) { if (context != null) { throw new ArgumentException("Must be null if scope is null.", "context"); } return; } if (scope.CallContext == false && SetHttpContextObject(ScopeItemKey, scope, false)) { SetHttpContextObject(ScopeRefItemKey, StaticScopeReference); SetHttpContextObject(ContextItemKey, context); } else { SetCallContextObject(ScopeItemKey, scope); SetCallContextObject(ContextItemKey, context); } }
private IScopeInternal PopScope(IScopeInternal scope) { var poppedScope = _scopeStack.Pop(); RoslynDebug.Assert((object)poppedScope == scope); return(poppedScope); }
private IScopeInternal PopScope(IScopeInternal scope) { var poppedScope = _scopeStack.Pop(); LorettaDebug.Assert(poppedScope == scope); return(poppedScope); }
public Variable(VariableKind kind, IScopeInternal containingScope, string name, SyntaxNode?declaration) { RoslynDebug.AssertNotNull(containingScope); RoslynDebug.AssertNotNull(name); Kind = kind; ContainingScope = containingScope; Name = name; Declaration = declaration; ReferencingScopes = SpecializedCollections.ReadOnlyEnumerable(_referencingScopes); CapturingScopes = SpecializedCollections.ReadOnlyEnumerable(_capturingScopes); ReadLocations = SpecializedCollections.ReadOnlyEnumerable(_readLocations); WriteLocations = SpecializedCollections.ReadOnlyEnumerable(_writeLocations); }
public void AddCapturingScope(IScopeInternal scope) => _capturingScopes.Add(scope);
public void AddReferencingScope(IScopeInternal scope) => _referencingScopes.Add(scope);
/// <inheritdoc /> public IScopeInternal GetAmbientOrNoScope() { return(AmbientScope ?? (AmbientScope = new NoScope(this))); }