- Timestamp:
- Oct 2, 2017, 5:52:43 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:
- 3096ec1
- Parents:
- 93fe7141
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ResolveTypeof.cc
r93fe7141 r9d79f93 18 18 #include <cassert> // for assert 19 19 20 #include "Common/PassVisitor.h" // for PassVisitor 20 21 #include "Resolver.h" // for resolveInVoidContext 21 22 #include "SynTree/Expression.h" // for Expression … … 41 42 } 42 43 43 class ResolveTypeof : public Mutator{44 class ResolveTypeof : public WithShortCircuiting { 44 45 public: 45 46 ResolveTypeof( const SymTab::Indexer &indexer ) : indexer( indexer ) {} 46 Type *mutate( TypeofType *typeofType ); 47 void premutate( TypeofType *typeofType ); 48 Type * postmutate( TypeofType *typeofType ); 47 49 48 50 private: … … 50 52 }; 51 53 52 Type * resolveTypeof( Type *type, const SymTab::Indexer &indexer ) {53 ResolveTypeofmutator( indexer );54 Type * resolveTypeof( Type *type, const SymTab::Indexer &indexer ) { 55 PassVisitor<ResolveTypeof> mutator( indexer ); 54 56 return type->acceptMutator( mutator ); 55 57 } 56 58 57 Type *ResolveTypeof::mutate( TypeofType *typeofType ) { 59 void ResolveTypeof::premutate( TypeofType * ) { 60 visit_children = false; 61 } 62 63 Type * ResolveTypeof::postmutate( TypeofType *typeofType ) { 58 64 #if 0 59 std::c out<< "resolving typeof: ";60 typeofType->print( std::c out);61 std::c out<< std::endl;65 std::cerr << "resolving typeof: "; 66 typeofType->print( std::cerr ); 67 std::cerr << std::endl; 62 68 #endif 63 if ( typeofType-> get_expr()) {64 Expression * newExpr = resolveInVoidContext( typeofType->get_expr(), indexer );65 assert( newExpr->result && ! newExpr-> get_result()->isVoid() );66 Type * newType = newExpr->get_result();67 newExpr-> set_result( nullptr );69 if ( typeofType->expr ) { 70 Expression * newExpr = resolveInVoidContext( typeofType->expr, indexer ); 71 assert( newExpr->result && ! newExpr->result->isVoid() ); 72 Type * newType = newExpr->result; 73 newExpr->result = nullptr; 68 74 delete typeofType; 69 75 delete newExpr;
Note: See TracChangeset
for help on using the changeset viewer.