Changes in src/SynTree/Expression.cc [ddb80bd:487845d7]
- File:
-
- 1 edited
-
src/SynTree/Expression.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
rddb80bd r487845d7 83 83 } 84 84 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 98 85 VariableExpr::VariableExpr( DeclarationWithType *_var ) : Expression(), var( _var ) { 99 86 assert( var ); … … 602 589 if ( ! body.empty() ) { 603 590 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) { 604 result = maybeClone( exprStmt->expr->result);591 set_result( maybeClone( exprStmt->get_expr()->get_result() ) ); 605 592 } 606 593 } 607 594 // ensure that StmtExpr has a result type 608 595 if ( ! result ) { 609 result = new VoidType( Type::Qualifiers() );596 set_result( new VoidType( Type::Qualifiers() ) ); 610 597 } 611 598 }
Note:
See TracChangeset
for help on using the changeset viewer.