public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
			throw new global::System.NotImplementedException("CollectionInitializerExpression");
		}
Пример #2
0
		public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
			Debug.Assert((collectionInitializerExpression != null));
			Debug.Assert((collectionInitializerExpression.CreateExpressions != null));
			foreach (Expression o in collectionInitializerExpression.CreateExpressions) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return null;
		}
Пример #3
0
	void CollectionInitializer(out CollectionInitializerExpression outExpr) {
		Expression expr = null;
		CollectionInitializerExpression initializer = new CollectionInitializerExpression();
		Location startLocation = la.Location;

		Expect(35);
		if (StartOf(24)) {
			Expr(out expr);
			if (expr != null) { initializer.CreateExpressions.Add(expr); }

			while (NotFinalComma()) {
				Expect(22);
				Expr(out expr);
				if (expr != null) { initializer.CreateExpressions.Add(expr); }
			}
		}
		Expect(36);
		outExpr = initializer;
			outExpr.StartLocation = startLocation;
			outExpr.EndLocation = t.EndLocation;

	}
Пример #4
0
		public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
			Debug.Assert((collectionInitializerExpression != null));
			Debug.Assert((collectionInitializerExpression.CreateExpressions != null));
			for (int i = 0; i < collectionInitializerExpression.CreateExpressions.Count; i++) {
				Expression o = collectionInitializerExpression.CreateExpressions[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (Expression)nodeStack.Pop();
				if (o == null)
					collectionInitializerExpression.CreateExpressions.RemoveAt(i--);
				else
					collectionInitializerExpression.CreateExpressions[i] = o;
			}
			return null;
		}
Пример #5
0
		public ObjectCreateExpression(TypeReference createType, List<Expression> parameters) {
			CreateType = createType;
			Parameters = parameters;
			objectInitializer = CollectionInitializerExpression.Null;
		}
Пример #6
0
	void ObjectCreateExpression(out Expression oce) {
		TypeReference type = null;
		CollectionInitializerExpression initializer = null;
		List<Expression> arguments = null;
		ArrayList dimensions = null;
		oce = null;
		Location startLocation = la.Location;
		bool canBeNormal; bool canBeReDim;

		Expect(162);
		if (StartOf(9)) {
			NonArrayTypeName(out type, false);
			if (la.kind == 37) {
				Get();
				NormalOrReDimArgumentList(out arguments, out canBeNormal, out canBeReDim);
				Expect(38);
				if (la.kind == 35 || (la.kind == Tokens.OpenParenthesis)) {
					if (la.kind == Tokens.OpenParenthesis) {
						ArrayTypeModifiers(out dimensions);
						CollectionInitializer(out initializer);
					} else {
						CollectionInitializer(out initializer);
					}
				}
				if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression();
			}
		}
		if (initializer == null) {
				oce = new ObjectCreateExpression(type, arguments);
			} else {
				if (dimensions == null) dimensions = new ArrayList();
				dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
				type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
				ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer);
				ace.Arguments = arguments;
				oce = ace;
			}

		if (la.kind == 126 || la.kind == 233) {
			if (la.kind == 233) {
				MemberInitializerExpression memberInitializer = null;
					Expression anonymousMember = null;

				Get();
				CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression();
					memberInitializers.StartLocation = la.Location;

				Expect(35);
				if (la.kind == 26 || la.kind == 147) {
					MemberInitializer(out memberInitializer);
					memberInitializers.CreateExpressions.Add(memberInitializer);
				} else if (StartOf(24)) {
					Expr(out anonymousMember);
					memberInitializers.CreateExpressions.Add(anonymousMember);
				} else SynErr(272);
				while (la.kind == 22) {
					Get();
					if (la.kind == 26 || la.kind == 147) {
						MemberInitializer(out memberInitializer);
						memberInitializers.CreateExpressions.Add(memberInitializer);
					} else if (StartOf(24)) {
						Expr(out anonymousMember);
						memberInitializers.CreateExpressions.Add(anonymousMember);
					} else SynErr(273);
				}
				Expect(36);
				memberInitializers.EndLocation = t.Location;
					if(oce is ObjectCreateExpression)
					{
						((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers;
					}

			} else {
				Get();
				CollectionInitializer(out initializer);
				if(oce is ObjectCreateExpression)
						((ObjectCreateExpression)oce).ObjectInitializer = initializer;

			}
		}
		if (oce != null) {
				oce.StartLocation = startLocation;
				oce.EndLocation = t.EndLocation;
			}

	}
Пример #7
0
		public ArrayCreateExpression(TypeReference createType, CollectionInitializerExpression arrayInitializer) {
			CreateType = createType;
			ArrayInitializer = arrayInitializer;
			arguments = new List<Expression>();
		}
Пример #8
0
		public ArrayCreateExpression(TypeReference createType, List<Expression> arguments) {
			CreateType = createType;
			Arguments = arguments;
			arrayInitializer = CollectionInitializerExpression.Null;
		}
Пример #9
0
		public ArrayCreateExpression(TypeReference createType) {
			CreateType = createType;
			arguments = new List<Expression>();
			arrayInitializer = CollectionInitializerExpression.Null;
		}
Пример #10
0
		public virtual object TrackedVisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
			return base.VisitCollectionInitializerExpression(collectionInitializerExpression, data);
		}
Пример #11
0
		public sealed override object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
			this.BeginVisit(collectionInitializerExpression);
			object result = this.TrackedVisitCollectionInitializerExpression(collectionInitializerExpression, data);
			this.EndVisit(collectionInitializerExpression);
			return result;
		}