示例#1
0
        public override AST_Node VisitFeatureprop([NotNull] CoolParser.FeaturepropContext context)
        {
            var           v      = context.property();
            var           formal = v.formal();
            AST_Id        id     = new AST_Id(formal.ID(), formal.ID().GetText());
            AST_Type_Node type   = new AST_Type_Node(formal.TYPE(), formal.TYPE().GetText());
            AST_Expresion exp    = null;

            if (v.expr() != null)
            {
                exp = (AST_Expresion)Visit(v.expr());
            }
            var formald = new AST_FormalDec(v.formal(), id, type);

            return(new AST_ClassProperty(context, formald, exp));
        }
 /// <summary>
 /// Visit a parse tree produced by the <c>featureprop</c>
 /// labeled alternative in <see cref="CoolParser.feature"/>.
 /// <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 VisitFeatureprop([NotNull] CoolParser.FeaturepropContext context)
 {
     return(VisitChildren(context));
 }