Changeset d29fa5f for src/SynTree
- Timestamp:
- Oct 2, 2017, 4:58:51 PM (7 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:
- effdde0
- Parents:
- bf4b4cf
- Location:
- src/SynTree
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AddressExpr.cc
rbf4b4cf rd29fa5f 33 33 Type * addrType( Type * type ) { 34 34 if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( type ) ) { 35 return new ReferenceType( refType->get_qualifiers(), addrType( refType-> get_base()) );35 return new ReferenceType( refType->get_qualifiers(), addrType( refType->base ) ); 36 36 } else { 37 37 return new PointerType( Type::Qualifiers(), type->clone() ); … … 41 41 42 42 AddressExpr::AddressExpr( Expression *arg ) : Expression(), arg( arg ) { 43 if ( arg-> has_result()) {44 if ( arg-> get_result()->get_lvalue() ) {43 if ( arg->result ) { 44 if ( arg->result->get_lvalue() ) { 45 45 // lvalue, retains all layers of reference and gains a pointer inside the references 46 set_result( addrType( arg-> get_result()) );46 set_result( addrType( arg->result ) ); 47 47 } else { 48 48 // taking address of non-lvalue -- must be a reference, loses one layer of reference 49 ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg-> get_result());50 set_result( addrType( refType-> get_base()) );49 ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->result ); 50 set_result( addrType( refType->base ) ); 51 51 } 52 52 // result of & is never an lvalue -
src/SynTree/ApplicationExpr.cc
rbf4b4cf rd29fa5f 55 55 set_result( ResolvExpr::extractResultType( function ) ); 56 56 57 assert( has_result());57 assert( result ); 58 58 } 59 59 -
src/SynTree/Expression.h
rbf4b4cf rd29fa5f 45 45 const Type * get_result() const { return result; } 46 46 void set_result( Type * newValue ) { result = newValue; } 47 bool has_result() const { return result != nullptr; }48 47 49 48 TypeSubstitution * get_env() const { return env; }
Note: See TracChangeset
for help on using the changeset viewer.