Changeset 6840e7c for src/ResolvExpr/ResolveTypeof.cc
- Timestamp:
- Oct 19, 2017, 12:01:04 PM (8 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 837ce06
- Parents:
- b96ec83 (diff), a15b72c (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/ResolvExpr/ResolveTypeof.cc
rb96ec83 r6840e7c 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-> has_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.