public override CSharpSyntaxNode VisitLambda([NotNull] DonatelloParser.LambdaContext context) { var children = context.form(); var body = CreateListInvocation(children); var arguments = GetLambdaParameters(body) .Select(identifier => identifier.Identifier.ValueText) .Where(identifier => identifier.StartsWith(UniqueId, StringComparison.Ordinal)) .Distinct() .OrderBy(i => i) .Select(identifier => Parameter(Identifier(identifier))); return(ParenthesizedLambdaExpression(body) .WithParameterList( ParameterList( SeparatedList( arguments)))); }
/// <summary> /// Exit a parse tree produced by <see cref="DonatelloParser.lambda"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitLambda([NotNull] DonatelloParser.LambdaContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="DonatelloParser.lambda"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitLambda([NotNull] DonatelloParser.LambdaContext context) { return(VisitChildren(context)); }