Ignore:
Timestamp:
Aug 30, 2018, 6:30:10 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer
Children:
7e08acf, a9fb796, e255e69
Parents:
933933c
Message:

fix 0 and 1 for new for-control

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r933933c r0982a05  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 29 16:44:17 2018
    13 // Update Count     : 4006
     12// Last Modified On : Thu Aug 30 17:02:25 2018
     13// Update Count     : 4029
    1414//
    1515
     
    191191
    192192ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
     193        ConstantExpr *constant = dynamic_cast<ConstantExpr *>(type->get_expr());
     194        if ( constant && (constant->get_constant()->get_value() == "0" || constant->get_constant()->get_value() == "1") ) {
     195        type = new ExpressionNode( new CastExpr( maybeMoveBuild< Expression >(type), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ) );
     196        } // if
    193197        return new ForCtrl(
    194198                distAttr( DeclarationNode::newTypeof( type ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ),
     
    218222
    219223// Types declaration for productions
    220 %union
    221 {
     224%union {
    222225        Token tok;
    223226        ParseNode * pn;
Note: See TracChangeset for help on using the changeset viewer.