示例#1
0
 internal ExpressionScope(IScopeProvider scopeProvider, ExpressionScope parent, string name, ExpressionScopeType scopeType, int depth)
 {
     this.scopeProvider = scopeProvider;
     this.Parent        = parent;
     this.name          = name;
     this.Type          = scopeType;
     this.Depth         = depth;
 }
        public ExpressionScope Get(string name, ExpressionScopeType scopeType)
        {
            var depth    = this.Current.Depth + 1;
            var scopeKey = depth + name + "_" + scopeType;

            if (scopes.TryGetValue(scopeKey, out var scope))
            {
                return(scope);
            }

            return(Current = scopes[scopeKey] = new ExpressionScope(this, Current, name, scopeType, depth));
        }
 public void EndScope(ExpressionScope expressionScope)
 {
     Current = expressionScope.Parent;
 }
 public DefaultScopeProvider()
 {
     this.Current = globalScope = new ExpressionScope(this, null, GlobalScopeIdentifier, ExpressionScopeType.Global, 0);
 }