Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
            private IScopeInternal PopScope(IScopeInternal scope)
            {
                var poppedScope = _scopeStack.Pop();

                RoslynDebug.Assert((object)poppedScope == scope);
                return(poppedScope);
            }
Esempio n. 3
0
            private IScopeInternal PopScope(IScopeInternal scope)
            {
                var poppedScope = _scopeStack.Pop();

                LorettaDebug.Assert(poppedScope == scope);
                return(poppedScope);
            }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public void AddCapturingScope(IScopeInternal scope) =>
 _capturingScopes.Add(scope);
Esempio n. 6
0
 public void AddReferencingScope(IScopeInternal scope) =>
 _referencingScopes.Add(scope);
Esempio n. 7
0
 /// <inheritdoc />
 public IScopeInternal GetAmbientOrNoScope()
 {
     return(AmbientScope ?? (AmbientScope = new NoScope(this)));
 }