Exemplo n.º 1
0
		public virtual object VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression, object data) {
			Debug.Assert((arrayInitializerExpression != null));
			Debug.Assert((arrayInitializerExpression.CreateExpressions != null));
			foreach (Expression o in arrayInitializerExpression.CreateExpressions) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return null;
		}
		public virtual object TrackedVisit(ArrayInitializerExpression arrayInitializerExpression, object data) {
			return base.VisitArrayInitializerExpression(arrayInitializerExpression, data);
		}
		public sealed override object VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression, object data) {
			this.BeginVisit(arrayInitializerExpression);
			object result = this.TrackedVisit(arrayInitializerExpression, data);
			this.EndVisit(arrayInitializerExpression);
			return result;
		}
Exemplo n.º 4
0
		public ArrayCreateExpression(TypeReference createType, ArrayInitializerExpression arrayInitializer) {
			CreateType = createType;
			ArrayInitializer = arrayInitializer;
			arguments = new List<Expression>();
		}
Exemplo n.º 5
0
		public ArrayCreateExpression(TypeReference createType, List<Expression> arguments) {
			CreateType = createType;
			Arguments = arguments;
			arrayInitializer = ArrayInitializerExpression.Null;
		}
Exemplo n.º 6
0
		public ArrayCreateExpression(TypeReference createType) {
			CreateType = createType;
			arguments = new List<Expression>();
			arrayInitializer = ArrayInitializerExpression.Null;
		}
Exemplo n.º 7
0
	void ArrayInitializer(
#line  1440 "VBNET.ATG" 
out Expression outExpr) {

#line  1442 "VBNET.ATG" 
		Expression expr = null;
		ArrayInitializerExpression initializer = new ArrayInitializerExpression();
		
		Expect(22);
		if (StartOf(28)) {
			VariableInitializer(
#line  1447 "VBNET.ATG" 
out expr);

#line  1449 "VBNET.ATG" 
			if (expr != null) { initializer.CreateExpressions.Add(expr); }
			
			while (
#line  1452 "VBNET.ATG" 
NotFinalComma()) {
				Expect(12);
				VariableInitializer(
#line  1452 "VBNET.ATG" 
out expr);

#line  1453 "VBNET.ATG" 
				if (expr != null) { initializer.CreateExpressions.Add(expr); } 
			}
		}
		Expect(23);

#line  1456 "VBNET.ATG" 
		outExpr = initializer; 
	}
Exemplo n.º 8
0
	void ObjectCreateExpression(
#line  1832 "VBNET.ATG" 
out Expression oce) {

#line  1834 "VBNET.ATG" 
		TypeReference type = null;
		Expression initializer = null;
		List<Expression> arguments = null;
		ArrayList dimensions = null;
		oce = null;
		bool canBeNormal; bool canBeReDim;
		
		Expect(127);
		NonArrayTypeName(
#line  1841 "VBNET.ATG" 
out type, false);
		if (la.kind == 24) {
			lexer.NextToken();
			NormalOrReDimArgumentList(
#line  1842 "VBNET.ATG" 
out arguments, out canBeNormal, out canBeReDim);
			Expect(25);
			if (la.kind == 22 || 
#line  1843 "VBNET.ATG" 
la.kind == Tokens.OpenParenthesis) {
				if (
#line  1843 "VBNET.ATG" 
la.kind == Tokens.OpenParenthesis) {
					ArrayTypeModifiers(
#line  1844 "VBNET.ATG" 
out dimensions);
					ArrayInitializer(
#line  1845 "VBNET.ATG" 
out initializer);
				} else {
					ArrayInitializer(
#line  1846 "VBNET.ATG" 
out initializer);
				}
			}

#line  1848 "VBNET.ATG" 
			if (canBeReDim && !canBeNormal && initializer == null) initializer = new ArrayInitializerExpression(); 
		}

#line  1851 "VBNET.ATG" 
		if (type == null) type = new TypeReference("Object"); // fallback type on parser errors
		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 as ArrayInitializerExpression);
			ace.Arguments = arguments;
			oce = ace;
		}
		
	}
Exemplo n.º 9
0
		public override object VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression, object data)
		{
			// no calls allowed !!!
			return null;
		}
		public virtual object VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression, object data) {
			Debug.Assert((arrayInitializerExpression != null));
			Debug.Assert((arrayInitializerExpression.CreateExpressions != null));
			for (int i = 0; i < arrayInitializerExpression.CreateExpressions.Count; i++) {
				Expression o = arrayInitializerExpression.CreateExpressions[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (Expression)nodeStack.Pop();
				if (o == null)
					arrayInitializerExpression.CreateExpressions.RemoveAt(i--);
				else
					arrayInitializerExpression.CreateExpressions[i] = o;
			}
			return null;
		}