Exemplo n.º 1
0
        public override AST_Node VisitIf([NotNull] CoolParser.IfContext context)
        {
            AST_Expresion cond   = (AST_Expresion)Visit(context.expr(0));
            AST_Expresion corpus = (AST_Expresion)Visit(context.expr(1));

            return(new AST_If(context, cond, corpus, null));
        }
 public override ASTNode VisitIf([NotNull] CoolParser.IfContext context)
 {
     return(new ConditionalNode(context.Start.Line, context.Start.Column)
     {
         Condition = Visit(context.expr(0)) as ExpressionNode,
         IfBody = Visit(context.expr(1)) as ExpressionNode,
         ElseBody = Visit(context.expr(2)) as ExpressionNode
     });
 }