Esempio n. 1
0
        private Expression PostfixExpression()
        {
            var n = PrimaryExpression();

            while (_tokenizer.Token != CondToken.Eof)
            {
                switch (_tokenizer.Token)
                {
                case CondToken.Lpar:
                    _tokenizer.Next();
                    IReadOnlyList <Expression> list;
                    if (_tokenizer.Matches(CondToken.Rpar))
                    {
                        list = Empty.List <Expression>();
                    }
                    else
                    {
                        list = ExpressionList();
                        ExpectCurrent(CondToken.Rpar);
                    }

                    n = Expression.Call(InvokeMethod, ContextParameter, n,
                                        Expression.NewArrayInit(typeof(object), list));
                    continue;
                }

                break;
            }

            return(n);
        }
Esempio n. 2
0
        public void empty_list_returns_empty_list()
        {
            var list = Empty.List <int>();

            list.ShouldNotBeNull();
            list.ShouldBeEmpty();
        }
        public void AddRange_works_for_empty_collection()
        {
            var toAdd = Pack.IntoArray(4, 23, 12);
            ICollection <int> collection = Empty.List <int>();

            collection.AddRange(toAdd);

            collection.SequenceContentEqual(toAdd).ShouldBeTrue();
        }
Esempio n. 4
0
 static public IReadOnlyList <string> GetFullNamepace(this ISymbol _this)
 {
     if (_this.ContainingNamespace == null)
     {
         return(Empty.List <string>());
     }
     else
     {
         var previous = _this._GetFullNamepaceRec();
         return(previous.FromTopToBottom());
     }
 }
Esempio n. 5
0
 static public ComputationGraphNode FromMemberAccess(MemberAccessExpressionSyntax syntax, IXor2ComputationNodeReference previous)
 => new ComputationGraphNode(syntax, previous, varyingAntedecents: Empty.List <IXor2ComputationNodeReference>());
Esempio n. 6
0
        public void in_empty_collection_test()
        {
            const string toBuild = "select * from products where 1 = 1";
            var          query   = SqlBuilder.Select.AllFields.From("products").Where("id", Compare.In, Empty.List <int>()).Build();

            Assert.Equal(toBuild.ToLower(), query.ToLower());
        }
Esempio n. 7
0
 /// <summary>
 /// Packs given object into list
 /// </summary>
 /// <typeparam name="TSource">The type of the object.</typeparam>
 /// <returns></returns>
 public static List <TSource> PackIntoList <TSource>(this TSource source)
 {
     return(source != null ? new List <TSource> {
         source
     } : Empty.List <TSource>());
 }