Changeset 2f61765 for src/GenPoly
- Timestamp:
- Feb 3, 2023, 2:12:21 PM (19 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- e9b5043
- Parents:
- 2125443a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/ScrubTyVars.cc
r2125443a r2f61765 178 178 179 179 ast::Type const * ScrubTypeVars::postvisit( ast::TypeInstType const * type ) { 180 ast::TypeDecl::Kind kind; 180 181 // This implies that mode == ScrubMode::All. 181 182 if ( !typeVars ) { 182 if ( ast::TypeDecl::Ftype == type->kind ) { 183 return new ast::PointerType( 184 new ast::FunctionType( ast::FixedArgs ) ); 185 } else { 186 return new ast::PointerType( 187 new ast::VoidType( type->qualifiers ) ); 188 } 189 } 190 191 auto typeVar = typeVars->find( *type ); 192 if ( typeVar == typeVars->end() ) { 193 return type; 194 } 195 196 switch ( typeVar->second.kind ) { 197 case ::TypeDecl::Dtype: 198 case ::TypeDecl::Ttype: 183 kind = type->kind; 184 } else { 185 // Otherwise, only scrub the type var if it is in map. 186 auto typeVar = typeVars->find( *type ); 187 if ( typeVar == typeVars->end() ) { 188 return type; 189 } 190 kind = typeVar->second.kind; 191 } 192 193 switch ( kind ) { 194 case ast::TypeDecl::Dtype: 195 case ast::TypeDecl::Ttype: 199 196 return new ast::PointerType( 200 197 new ast::VoidType( type->qualifiers ) ); 201 case ::TypeDecl::Ftype:198 case ast::TypeDecl::Ftype: 202 199 return new ast::PointerType( 203 200 new ast::FunctionType( ast::VariableArgs ) ); 204 201 default: 205 assertf( false, 206 "Unhandled type variable kind: %d", typeVar->second.kind ); 202 assertf( false, "Unhandled type variable kind: %d", kind ); 207 203 throw; // Just in case the assert is removed, stop here. 208 204 }
Note: See TracChangeset
for help on using the changeset viewer.