Scope for the comprehension. Because scopes are usually statements and comprehensions are expressions this doesn't actually show up in the AST hierarchy and instead hangs off the comprehension expression.
Inheritance: ScopeStatement
 public DictionaryComprehension(Expression key, Expression value, ComprehensionIterator[] iterators)
 {
     _key       = key;
     _value     = value;
     _iterators = iterators;
     _scope     = new ComprehensionScope(this);
 }
Beispiel #2
0
        internal Comprehension CopyForRewrite(ComprehensionScope scope)
        {
            var newComprehension = (Comprehension)MemberwiseClone();

            newComprehension.Scope  = scope;
            newComprehension.Parent = scope.Parent;
            return(newComprehension);
        }
Beispiel #3
0
        public ListComprehension(Expression item, ComprehensionIterator[] iterators)
        {
            if (iterators is null || iterators.Length < 1)
            {
                throw new ArgumentException("comprehension with no generators");
            }
            if (iterators[0] is not ComprehensionFor)
            {
                throw new ArgumentException("comprehension with invalid generator");
            }

            Item       = item;
            _iterators = iterators;
            Scope      = new ComprehensionScope(this);
        }
Beispiel #4
0
        public DictionaryComprehension(Expression key, Expression value, ComprehensionIterator[] iterators)
        {
            if (iterators is null || iterators.Length < 1)
            {
                throw new ArgumentException("comprehension with no generators");
            }
            if (iterators[0] is not ComprehensionFor)
            {
                throw new ArgumentException("comprehension with invalid generator");
            }

            Key        = key;
            Value      = value;
            _iterators = iterators;
            Scope      = new ComprehensionScope(this);
        }
Beispiel #5
0
 public DictionaryComprehension(Expression key, Expression value, ComprehensionIterator[] iterators) {
     _key = key;
     _value = value;
     _iterators = iterators;
     _scope = new ComprehensionScope(this);
 }
Beispiel #6
0
 public SetComprehension(Expression item, ComprehensionIterator[] iterators) {
     _item = item;
     _iterators = iterators;
     _scope = new ComprehensionScope(this);
 }
 public ListComprehension(Expression item, ComprehensionIterator[] iterators)
 {
     _item      = item;
     _iterators = iterators;
     _scope     = new ComprehensionScope(this);
 }
Beispiel #8
0
 public SetComprehension(Expression item, ComprehensionIterator[] iterators)
 {
     Item       = item;
     _iterators = iterators;
     Scope      = new ComprehensionScope(this);
 }