Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    rab780e6 rbc61563  
    340340        }
    341341
    342         ast::ptr< ast::Expr > findCondExpression(
    343                 const ast::Expr * untyped, const ResolveContext & context
    344         ) {
    345                 if ( nullptr == untyped ) return untyped;
    346                 ast::ptr<ast::Expr> condExpr = createCondExpr( untyped );
    347                 return findIntegralExpression( condExpr, context );
    348         }
    349 
    350342        /// check if a type is a character type
    351343        bool isCharType( const ast::Type * t ) {
     
    364356                return it != end;
    365357        }
    366 } // anonymous namespace
     358}
    367359
    368360class Resolver final
     
    737729const ast::IfStmt * Resolver::previsit( const ast::IfStmt * ifStmt ) {
    738730        return ast::mutate_field(
    739                 ifStmt, &ast::IfStmt::cond, findCondExpression( ifStmt->cond, context ) );
     731                ifStmt, &ast::IfStmt::cond, findIntegralExpression( ifStmt->cond, context ) );
    740732}
    741733
    742734const ast::WhileDoStmt * Resolver::previsit( const ast::WhileDoStmt * whileDoStmt ) {
    743735        return ast::mutate_field(
    744                 whileDoStmt, &ast::WhileDoStmt::cond, findCondExpression( whileDoStmt->cond, context ) );
     736                whileDoStmt, &ast::WhileDoStmt::cond, findIntegralExpression( whileDoStmt->cond, context ) );
    745737}
    746738
     
    748740        if ( forStmt->cond ) {
    749741                forStmt = ast::mutate_field(
    750                         forStmt, &ast::ForStmt::cond, findCondExpression( forStmt->cond, context ) );
     742                        forStmt, &ast::ForStmt::cond, findIntegralExpression( forStmt->cond, context ) );
    751743        }
    752744
     
    10831075
    10841076                // Resolve the conditions as if it were an IfStmt, statements normally
    1085                 clause2->when_cond = findCondExpression( clause.when_cond, context );
     1077                clause2->when_cond = findSingleExpression( clause.when_cond, context );
    10861078                clause2->stmt = clause.stmt->accept( *visitor );
    10871079
     
    10971089                        new ast::BasicType{ ast::BasicType::LongLongUnsignedInt };
    10981090                auto timeout_time = findSingleExpression( stmt->timeout_time, target, context );
    1099                 auto timeout_cond = findCondExpression( stmt->timeout_cond, context );
     1091                auto timeout_cond = findSingleExpression( stmt->timeout_cond, context );
    11001092                auto timeout_stmt = stmt->timeout_stmt->accept( *visitor );
    11011093
     
    11101102        if ( stmt->else_stmt ) {
    11111103                // resolve the condition like IfStmt, stmts normally
    1112                 auto else_cond = findCondExpression( stmt->else_cond, context );
     1104                auto else_cond = findSingleExpression( stmt->else_cond, context );
    11131105                auto else_stmt = stmt->else_stmt->accept( *visitor );
    11141106
Note: See TracChangeset for help on using the changeset viewer.