Example #1
0
        public override AST_Node VisitLet([NotNull] CoolParser.LetContext context)
        {
            List <AST_ClassProperty> param  = new List <AST_ClassProperty>();
            AST_Expresion            corpus = (AST_Expresion)Visit(context.expr());

            foreach (var item in context.property())
            {
                var           iid     = new AST_Id(item.formal().ID(), item.formal().ID().GetText());
                var           ity     = new AST_Type_Node(item.formal().TYPE(), item.formal().TYPE().GetText());
                var           formald = new AST_FormalDec(item, iid, ity);
                AST_Expresion subexp  = null;
                if (item.expr() != null)
                {
                    subexp = (AST_Expresion)Visit(item.expr());
                }
                AST_ClassProperty i = new AST_ClassProperty(item, formald, subexp);
                param.Add(i);
            }
            return(new AST_Let(context, new AST_ListProp(context, param), corpus));
        }
 /// <summary>
 /// Visit a parse tree produced by the <c>let</c>
 /// labeled alternative in <see cref="CoolParser.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 VisitLet([NotNull] CoolParser.LetContext context)
 {
     return(VisitChildren(context));
 }