A node representing a method being invoked.
Inheritance: Lens.SyntaxTree.Expressions.InvocationNodeBase
Ejemplo n.º 1
0
        /// <summary>
        /// line_invoke_base_expr                       = get_expr [ invoke_line_args ]
        /// </summary>
        private NodeBase parseLineInvokeBaseExpr()
        {
            var expr = attempt(parseGetExpr);
            if (expr == null)
                return null;

            var args = parseInvokeLineArgs().ToList();
            if (args.Count == 0)
                return expr;

            var node = new InvocationNode();
            node.Expression = expr;
            node.Arguments = args;
            return node;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// invoke_pass                                 = "******" identifier ( invoke_block_args | invoke_line_args )
        /// </summary>
        private InvocationNode parseInvokePass()
        {
            if (!check(LexemType.PassRight))
                return null;

            var getter = new GetMemberNode();
            var invoker = new InvocationNode { Expression = getter };

            getter.MemberName = ensure(LexemType.Identifier, ParserMessages.MemberNameExpected).Value;

            invoker.Arguments = parseInvokeBlockArgs().ToList();
            if (invoker.Arguments.Count == 0)
                invoker.Arguments = parseInvokeLineArgs().ToList();

            if (invoker.Arguments.Count == 0)
                error(ParserMessages.ArgumentsExpected);

            return invoker;
        }
Ejemplo n.º 3
0
 protected bool Equals(InvocationNode other)
 {
     return(base.Equals(other) &&
            Equals(Expression, other.Expression));
 }
Ejemplo n.º 4
0
 protected bool Equals(InvocationNode other)
 {
     return base.Equals(other)
         && Equals(Expression, other.Expression);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// invoke_pass                                 = "******" identifier [ type_args ] ( invoke_block_args | invoke_line_args )
        /// </summary>
        private InvocationNode parseInvokePass()
        {
            if (!check(LexemType.PassRight))
                return null;

            var getter = new GetMemberNode();
            var invoker = new InvocationNode { Expression = getter };

            getter.MemberName = ensure(LexemType.Identifier, ParserMessages.MemberNameExpected).Value;

            var hints = attempt(parseTypeArgs);
            if(hints != null)
                getter.TypeHints = hints;

            var lambda = attempt(parseLambdaLineExpr);
            if (lambda != null)
            {
                invoker.Arguments = new List<NodeBase> { lambda };
            }
            else
            {
                invoker.Arguments = parseInvokeBlockArgs().ToList();
                if (invoker.Arguments.Count == 0)
                    invoker.Arguments = parseInvokeLineArgs().ToList();

                if (invoker.Arguments.Count == 0)
                    error(ParserMessages.ArgumentsExpected);
            }

            return invoker;
        }