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); }
/// <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); }
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); }
public void CompileListInitializer(ListInitializer listInit) { DumpExpressionsList(listInit.Items, "[", "]"); }