Changeset e491159 for src/GenPoly
- Timestamp:
- Aug 31, 2016, 11:20:03 AM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, 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:
- 1f75e2d
- Parents:
- bda58ad
- Location:
- src/GenPoly
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/GenPoly/Box.cc ¶
rbda58ad re491159 29 29 #include "PolyMutator.h" 30 30 #include "FindFunction.h" 31 #include "ScopedMap.h"32 31 #include "ScopedSet.h" 33 32 #include "ScrubTyVars.h" … … 51 50 #include "SymTab/Mangler.h" 52 51 52 #include "Common/ScopedMap.h" 53 53 #include "Common/SemanticError.h" 54 54 #include "Common/UniqueName.h" -
TabularUnified src/GenPoly/InstantiateGeneric.cc ¶
rbda58ad re491159 23 23 #include "DeclMutator.h" 24 24 #include "GenPoly.h" 25 #include "ScopedMap.h"26 25 #include "ScopedSet.h" 27 26 … … 32 31 #include "SynTree/Type.h" 33 32 33 #include "Common/ScopedMap.h" 34 34 #include "Common/UniqueName.h" 35 35 #include "Common/utility.h" … … 84 84 std::list< Type* > params; ///< Instantiation parameters 85 85 }; 86 86 87 87 /// Maps a key and a TypeList to the some value, accounting for scope 88 88 template< typename Key, typename Value > … … 145 145 return gt; 146 146 } 147 147 148 148 /// Mutator pass that replaces concrete instantiations of generic types with actual struct declarations, scoped appropriately 149 149 class GenericInstantiator : public DeclMutator { … … 193 193 TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param ); 194 194 assert(paramType && "Aggregate parameters should be type expressions"); 195 195 196 196 switch ( (*baseParam)->get_kind() ) { 197 197 case TypeDecl::Any: { … … 242 242 inst->get_parameters().clear(); 243 243 } 244 244 245 245 void GenericInstantiator::stripDtypeParams( AggregateDecl *base, std::list< TypeDecl* >& baseParams, const std::list< TypeExpr* >& typeSubs ) { 246 246 substituteMembers( base->get_members(), baseParams, typeSubs ); … … 248 248 deleteAll( baseParams ); 249 249 baseParams.clear(); 250 250 251 251 dtypeStatics.insert( base ); 252 252 } … … 266 266 return inst; 267 267 } 268 268 269 269 // check if type can be concretely instantiated; put substitutions into typeSubs 270 270 assert( inst->get_baseParameters() && "Base struct has parameters" ); … … 276 276 stripInstParams( inst ); 277 277 break; 278 278 279 279 case genericType::concrete: { 280 280 // make concrete instantiation of generic type … … 328 328 stripInstParams( inst ); 329 329 break; 330 330 331 331 case genericType::concrete: 332 332 {
Note: See TracChangeset
for help on using the changeset viewer.