- File:
-
- 1 edited
-
src/GenPoly/InstantiateGenericNew.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/InstantiateGenericNew.cpp
r01865fb r8f1e035 22 22 23 23 #include "AST/Copy.hpp" // for deepCopy 24 #include "AST/Create.hpp" // for asForward 24 25 #include "AST/Pass.hpp" // for Pass, WithGuard, WithShortCi... 25 26 #include "AST/TranslationUnit.hpp" // for TranslationUnit … … 85 86 86 87 /// Maps a key and a TypeList to a valuue. Also supports scoping. 87 class InstantiationMap {88 class InstantiationMap final { 88 89 /// Wraps value for a specific (AggregateDecl, TypeList) combination. 89 90 using Instantiation = std::pair<TypeList, ast::ptr<ast::AggregateDecl>>; … … 255 256 void stripInstParams( ast::BaseInstType * inst ) { 256 257 inst->params.clear(); 257 }258 259 // TODO: I think this should become a generic helper.260 template<typename Aggr>261 Aggr * asForward( Aggr const * decl ) {262 if ( !decl->body ) {263 return nullptr;264 }265 Aggr * mut = ast::deepCopy( decl );266 mut->body = false;267 mut->members.clear();268 return mut;269 258 } 270 259 … … 553 542 // Forward declare before recursion. (TODO: Only when needed, #199.) 554 543 insert( inst, typeSubs, newDecl ); 555 if ( AggrDecl const * forwardDecl = as Forward( newDecl ) ) {544 if ( AggrDecl const * forwardDecl = ast::asForward( newDecl ) ) { 556 545 declsToAddBefore.push_back( forwardDecl ); 557 546 }
Note:
See TracChangeset
for help on using the changeset viewer.