Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    rddb80bd r487845d7  
    8383}
    8484
    85 long long int ConstantExpr::intValue() const {
    86         if ( BasicType * basicType = dynamic_cast< BasicType * >( result ) ) {
    87                 if ( basicType->isInteger() ) {
    88                         return get_constant()->get_ival();
    89                 }
    90         } else if ( dynamic_cast< OneType * >( result ) ) {
    91                 return 1;
    92         } else if ( dynamic_cast< ZeroType * >( result ) ) {
    93                 return 0;
    94         }
    95         throw SemanticError( "Constant expression of non-integral type ", this );
    96 }
    97 
    9885VariableExpr::VariableExpr( DeclarationWithType *_var ) : Expression(), var( _var ) {
    9986        assert( var );
     
    602589        if ( ! body.empty() ) {
    603590                if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
    604                         result = maybeClone( exprStmt->expr->result );
     591                        set_result( maybeClone( exprStmt->get_expr()->get_result() ) );
    605592                }
    606593        }
    607594        // ensure that StmtExpr has a result type
    608595        if ( ! result ) {
    609                 result = new VoidType( Type::Qualifiers() );
     596                set_result( new VoidType( Type::Qualifiers() ) );
    610597        }
    611598}
Note: See TracChangeset for help on using the changeset viewer.