Changes in / [63afee0:66a2a61]
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/InstantiateGeneric.cc
r63afee0 r66a2a61 219 219 StructDecl *concDecl = instantiations.lookup( inst ); 220 220 if ( ! concDecl ) { 221 assert( inst->get_baseParameters() && "Base struct has parameters" ); 221 222 // set concDecl to new type, insert type declaration into statements to add 222 223 concDecl = new StructDecl( typeNamer.newName( inst->get_name() ) ); 223 224 substituteMembers( inst->get_baseStruct()->get_members(), 224 inst->get_baseParameters(), inst->get_parameters(),225 *inst->get_baseParameters(), inst->get_parameters(), 225 226 concDecl->get_members() ); 226 227 addDeclaration( concDecl ); … … 246 247 if ( ! concDecl ) { 247 248 // set concDecl to new type, insert type declaration into statements to add 249 assert( inst->get_baseParameters() && "Base union has parameters" ); 248 250 concDecl = new UnionDecl( typeNamer.newName( inst->get_name() ) ); 249 251 substituteMembers( inst->get_baseUnion()->get_members(), 250 inst->get_baseParameters(), inst->get_parameters(),252 *inst->get_baseParameters(), inst->get_parameters(), 251 253 concDecl->get_members() ); 252 254 addDeclaration( concDecl ); -
src/SynTree/ReferenceToType.cc
r63afee0 r66a2a61 59 59 std::string StructInstType::typeString() const { return "struct"; } 60 60 61 std::list<TypeDecl*>& StructInstType::get_baseParameters() { return baseStruct->get_parameters(); } 61 std::list<TypeDecl*>* StructInstType::get_baseParameters() { 62 if ( ! baseStruct ) return NULL; 63 return &baseStruct->get_parameters(); 64 } 62 65 63 66 void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { … … 68 71 std::string UnionInstType::typeString() const { return "union"; } 69 72 70 std::list<TypeDecl*>& UnionInstType::get_baseParameters() { return baseUnion->get_parameters(); } 73 std::list<TypeDecl*>* UnionInstType::get_baseParameters() { 74 if ( ! baseUnion ) return NULL; 75 return &baseUnion->get_parameters(); 76 } 71 77 72 78 void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { -
src/SynTree/Type.h
r63afee0 r66a2a61 238 238 void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; } 239 239 240 /// Accesses generic parameters of base struct 241 std::list<TypeDecl*> &get_baseParameters();240 /// Accesses generic parameters of base struct (NULL if none such) 241 std::list<TypeDecl*>* get_baseParameters(); 242 242 243 243 /// Looks up the members of this struct named "name" and places them into "foundDecls". … … 265 265 void set_baseUnion( UnionDecl *newValue ) { baseUnion = newValue; } 266 266 267 /// Accesses generic parameters of base union 268 std::list<TypeDecl*> &get_baseParameters();267 /// Accesses generic parameters of base union (NULL if none such) 268 std::list<TypeDecl*>* get_baseParameters(); 269 269 270 270 /// looks up the members of this union named "name" and places them into "foundDecls" -
src/SynTree/TypeSubstitution.cc
r63afee0 r66a2a61 147 147 } // if 148 148 // bind type variables from generic type instantiations 149 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_baseParameters().begin(); tyvar != type->get_baseParameters().end(); ++tyvar ) { 150 boundVars.insert( (*tyvar)->get_name() ); 151 } // for 149 std::list< TypeDecl* > *baseParameters = type->get_baseParameters(); 150 if ( baseParameters && ! type->get_parameters().empty() ) { 151 for ( std::list< TypeDecl* >::const_iterator tyvar = baseParameters->begin(); tyvar != baseParameters->end(); ++tyvar ) { 152 boundVars.insert( (*tyvar)->get_name() ); 153 } // for 154 } // if 152 155 Type *ret = Mutator::mutate( type ); 153 156 boundVars = oldBoundVars;
Note: See TracChangeset
for help on using the changeset viewer.