public override object Visit (Mono.CSharp.LambdaExpression lambdaExpression)
			{
				var result = new LambdaExpression ();
				var location = LocationsBag.GetLocations (lambdaExpression);
				
				if (location == null || location.Count == 1) {
					AddParameter (result, lambdaExpression.Parameters);
					if (location != null)
						result.AddChild (new CSharpTokenNode (Convert (location [0]), "=>".Length), LambdaExpression.ArrowRole);
				} else {
					result.AddChild (new CSharpTokenNode (Convert (lambdaExpression.Location), 1), LambdaExpression.Roles.LPar);
					AddParameter (result, lambdaExpression.Parameters);
					if (location != null) {
						result.AddChild (new CSharpTokenNode (Convert (location [0]), 1), LambdaExpression.Roles.RPar);
						result.AddChild (new CSharpTokenNode (Convert (location [1]), "=>".Length), LambdaExpression.ArrowRole);
					}
				}
				if (lambdaExpression.Block.IsCompilerGenerated) {
					ContextualReturn generatedReturn = (ContextualReturn)lambdaExpression.Block.Statements [0];
					result.AddChild ((AstNode)generatedReturn.Expr.Accept (this), LambdaExpression.BodyRole);
				} else {
					result.AddChild ((AstNode)lambdaExpression.Block.Accept (this), LambdaExpression.BodyRole);
				}
				
				return result;
			}
Ejemplo n.º 2
0
			public override object Visit(Mono.CSharp.LambdaExpression lambdaExpression)
			{
				var result = new LambdaExpression();
				var location = LocationsBag.GetLocations(lambdaExpression);
				int l = 0;
				if (lambdaExpression.IsAsync) {
					result.IsAsync = true;
					result.AddChild(new CSharpTokenNode(Convert(location [l++]), LambdaExpression.AsyncModifierRole), LambdaExpression.AsyncModifierRole);
				}
				if (location == null || location.Count == l + 1) {
					if (lambdaExpression.Block != null)
						AddParameter(result, lambdaExpression.Parameters);
					if (location != null)
						result.AddChild(new CSharpTokenNode(Convert(location [l++]), LambdaExpression.ArrowRole), LambdaExpression.ArrowRole);
				} else {
					result.AddChild(new CSharpTokenNode(Convert(location [l++]), Roles.LPar), Roles.LPar);
					if (lambdaExpression.Block != null)
						AddParameter(result, lambdaExpression.Parameters);
					if (location != null) {
						result.AddChild(new CSharpTokenNode(Convert(location [l++]), Roles.RPar), Roles.RPar);
						result.AddChild(new CSharpTokenNode(Convert(location [l++]), LambdaExpression.ArrowRole), LambdaExpression.ArrowRole);
					}
				}
				if (lambdaExpression.Block != null) {
					if (lambdaExpression.Block.IsCompilerGenerated) {
						var generatedReturn = (ContextualReturn)lambdaExpression.Block.Statements [0];
						result.AddChild((AstNode)generatedReturn.Expr.Accept(this), LambdaExpression.BodyRole);
					} else {
						result.AddChild((AstNode)lambdaExpression.Block.Accept(this), LambdaExpression.BodyRole);
					}
				}
				return result;
			}
Ejemplo n.º 3
0
		public virtual object Visit (LambdaExpression lambdaExpression)
		{
			return null;
		}