public override Node VisitMethod([NotNull] coolgrammarParser.MethodContext context)
        {
            List <Formal> args = new List <Formal>();

            foreach (var item in context.args_def().formal())
            {
                var v = Visit(item);
                args.Add((Formal)v);
            }
            Expr exp = (Expr)Visit(context.expr());

            return(new Method_Def(new Id(context.ID().GetText()), new Type_cool(context.TYPE().GetText()), new Lista <Formal>(args), exp));
        }
 /// <summary>
 /// Visit a parse tree produced by <see cref="coolgrammarParser.method"/>.
 /// <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 VisitMethod([NotNull] coolgrammarParser.MethodContext context)
 {
     return(VisitChildren(context));
 }