public List <T> Build <T>()
    {
        var factory     = new ListFactory <T>(size);
        var list        = factory.Create();
        var initializer = new ListInitializer <T>(default(T), size);

        initializer.Initialize(list);
        return(list);
    }
예제 #2
0
        /// <summary>
        /// Recognizes a list's initializer.
        /// </summary>
        /// <returns>An <see cref="ListInitializer"/></returns>
        protected Expression ListInitializer()
        {
            Token first = Match(TokenID.LeftBracket);

            Expression[] items = List <Expression>(Expression, false, null);
            Token        last  = Match(TokenID.RightBracket);

            var initializer = new ListInitializer(items);

            initializer.SetLocation(first.Start, last.End);
            return(initializer);
        }
예제 #3
0
        public void CompileListInitializer(ListInitializer listInit)
        {
            XmlElement tmpElement      = document.CreateElement("ListInitializer");
            XmlElement previousElement = currentElement;

            currentElement = document.CreateElement("Items");
            foreach (Expression item in listInit.Items)
            {
                item.AcceptCompiler(this);
            }
            currentElement = previousElement;
            currentElement.AppendChild(tmpElement);
        }
예제 #4
0
 public void CompileListInitializer(ListInitializer listInit)
 {
     DumpExpressionsList(listInit.Items, "[", "]");
 }