Exemplo n.º 1
0
        public override Node VisitMethodCall([NotNull] FlyLangParser.MethodCallContext context)
        {
            var args = new List <Node>();

            if (context.expression() != null)
            {
                foreach (var expr in context.expression())
                {
                    args.Add(Visit(expr));
                }
            }
            if (context.id().ID().Length > 1)
            {
                var  ids    = context.id().ID();
                Node target = null;
                if (ids.Length == 2)
                {
                    target = new VarCall(ids[0].GetText());
                }
                return(new MethodCall(ids.Last().GetText(), args.ToArray(), target));
            }
            return(new MethodCall(context.id().GetText(), args.ToArray()));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="FlyLangParser.methodCall"/>.
 /// <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 VisitMethodCall([NotNull] FlyLangParser.MethodCallContext context)
 {
     return(VisitChildren(context));
 }