Exemple #1
0
			public override object Visit(ICSharpCode.NRefactory.MonoCSharp.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;
			}
Exemple #2
0
		public virtual object Visit (LambdaExpression lambdaExpression)
		{
			return null;
		}