public virtual object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
			Debug.Assert((anonymousMethodExpression != null));
			Debug.Assert((anonymousMethodExpression.Parameters != null));
			Debug.Assert((anonymousMethodExpression.Body != null));
			foreach (ParameterDeclarationExpression o in anonymousMethodExpression.Parameters) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return anonymousMethodExpression.Body.AcceptVisitor(this, data);
		}
		public virtual object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
			Debug.Assert((anonymousMethodExpression != null));
			Debug.Assert((anonymousMethodExpression.Parameters != null));
			Debug.Assert((anonymousMethodExpression.Body != null));
			for (int i = 0; i < anonymousMethodExpression.Parameters.Count; i++) {
				ParameterDeclarationExpression o = anonymousMethodExpression.Parameters[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (ParameterDeclarationExpression)nodeStack.Pop();
				if (o == null)
					anonymousMethodExpression.Parameters.RemoveAt(i--);
				else
					anonymousMethodExpression.Parameters[i] = o;
			}
			nodeStack.Push(anonymousMethodExpression.Body);
			anonymousMethodExpression.Body.AcceptVisitor(this, data);
			anonymousMethodExpression.Body = ((BlockStatement)(nodeStack.Pop()));
			return null;
		}
		public override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data)
		{
			foreach (ParameterDeclarationExpression p in anonymousMethodExpression.Parameters) {
				AddVariable(p.TypeReference, p.ParameterName,
				            anonymousMethodExpression.StartLocation, anonymousMethodExpression.EndLocation,
				            false, false, null, null, false, anonymousMethodExpression.EndLocation);
			}
			return base.VisitAnonymousMethodExpression(anonymousMethodExpression, data);
		}
Beispiel #4
0
	void AnonymousMethodExpr(
#line  2160 "Frames/cs.ATG" 
out Expression outExpr) {

#line  2162 "Frames/cs.ATG" 
		AnonymousMethodExpression expr = new AnonymousMethodExpression();
		expr.StartLocation = t.Location;
		BlockStatement stmt;
		List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
		outExpr = expr;
		
		if (la.kind == 20) {
			lexer.NextToken();
			if (StartOf(11)) {
				FormalParameterList(
#line  2171 "Frames/cs.ATG" 
p);

#line  2171 "Frames/cs.ATG" 
				expr.Parameters = p; 
			}
			Expect(21);

#line  2173 "Frames/cs.ATG" 
			expr.HasParameterList = true; 
		}
		BlockInsideExpression(
#line  2175 "Frames/cs.ATG" 
out stmt);

#line  2175 "Frames/cs.ATG" 
		expr.Body  = stmt; 

#line  2176 "Frames/cs.ATG" 
		expr.EndLocation = t.Location; 
	}
		public virtual object TrackedVisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
			return base.VisitAnonymousMethodExpression(anonymousMethodExpression, data);
		}
		public sealed override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
			this.BeginVisit(anonymousMethodExpression);
			object result = this.TrackedVisitAnonymousMethodExpression(anonymousMethodExpression, data);
			this.EndVisit(anonymousMethodExpression);
			return result;
		}
		public override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data)
		{
			base.VisitAnonymousMethodExpression(anonymousMethodExpression, data);
			if (anonymousMethodExpression.Body.Children.Count == 1) {
				ReturnStatement rs = anonymousMethodExpression.Body.Children[0] as ReturnStatement;
				if (rs != null) {
					LambdaExpression lambda = new LambdaExpression();
					lambda.ExpressionBody = rs.Expression;
					lambda.Parameters = anonymousMethodExpression.Parameters;
					ReplaceCurrentNode(lambda);
				}
			}
			return null;
		}
		public virtual object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
			throw new global::System.NotImplementedException("AnonymousMethodExpression");
		}