public override Node VisitDispatch([NotNull] coolgrammarParser.DispatchContext context) { Expr exp = (Expr)Visit(context.expr()); Type_cool t = null; if (context.TYPE() != null) { t = new Type_cool(context.TYPE().GetText()); } Id id = new Id(context.ID().GetText()); var list = new List <Expr>(); foreach (var item in context.args_call().expr()) { var v = Visit(item); list.Add((Expr)v); } return(new Dispatch(exp, t, new Call_Method(id, new Lista <Expr>(list)))); }
/// <summary> /// Visit a parse tree produced by the <c>dispatch</c> /// labeled alternative in <see cref="coolgrammarParser.expr"/>. /// <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 VisitDispatch([NotNull] coolgrammarParser.DispatchContext context) { return(VisitChildren(context)); }