Changeset b6838214 for src/SynTree/Expression.cc
- Timestamp:
- Jan 23, 2018, 5:46:43 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 258e6ad5
- Parents:
- b158d8f (diff), 15d248e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
rb158d8f rb6838214 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 85 98 VariableExpr::VariableExpr( DeclarationWithType *_var ) : Expression(), var( _var ) { 86 99 assert( var ); … … 95 108 // assert( inst->baseEnum ); 96 109 // EnumDecl * decl = inst->baseEnum; 97 // for ( Declaration * member : decl->members ) { 98 // if ( member == _var ) { 99 // type->set_lvalue( false ); 100 // } 110 // long long int value; 111 // if ( decl->valueOf( var, value ) ) { 112 // type->set_lvalue( false ); 101 113 // } 102 114 // } … … 403 415 } else { 404 416 // references have been removed, in which case dereference returns an lvalue of the base type. 405 ret-> get_result()->set_lvalue( true );417 ret->result->set_lvalue( true ); 406 418 } 407 419 } … … 589 601 if ( ! body.empty() ) { 590 602 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) { 591 set_result( maybeClone( exprStmt->get_expr()->get_result() ));603 result = maybeClone( exprStmt->expr->result ); 592 604 } 593 605 } 594 606 // ensure that StmtExpr has a result type 595 607 if ( ! result ) { 596 set_result( new VoidType( Type::Qualifiers()) );608 result = new VoidType( Type::Qualifiers() ); 597 609 } 598 610 }
Note:
See TracChangeset
for help on using the changeset viewer.