Changeset 0bfaf80 for src/GenPoly
- Timestamp:
- Jan 23, 2017, 4:27:33 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, 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:
- 4a9ccc3, 63f78f0
- Parents:
- 092528b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/InstantiateGeneric.cc
r092528b r0bfaf80 220 220 assert(paramType && "Aggregate parameters should be type expressions"); 221 221 222 switch ( (*baseParam)->get_kind() ) { 223 case TypeDecl::Any: { 224 // substitute parameter for otype; makes the type concrete or dynamic depending on the parameter 222 if ( (*baseParam)->isComplete() ) { 223 // substitute parameter for complete (otype or sized dtype) type; makes the struct concrete or dynamic depending on the parameter 225 224 out.push_back( paramType->clone() ); 226 225 gt |= isPolyType( paramType->get_type() ) ? genericType::dynamic : genericType::concrete; 227 break; 228 } 229 case TypeDecl::Dtype: 230 // can pretend that any dtype is `void` 231 out.push_back( new TypeExpr( new VoidType( Type::Qualifiers() ) ) ); 232 break; 233 case TypeDecl::Ftype: 234 // can pretend that any ftype is `void (*)(void)` 235 out.push_back( new TypeExpr( new FunctionType( Type::Qualifiers(), false ) ) ); 236 break; 237 case TypeDecl::Ttype: 238 assertf( false, "Ttype parameters are not currently allowed as parameters to generic types." ); 239 break; 226 } else switch ( (*baseParam)->get_kind() ) { 227 case TypeDecl::Dtype: 228 // can pretend that any incomplete dtype is `void` 229 out.push_back( new TypeExpr( new VoidType( Type::Qualifiers() ) ) ); 230 break; 231 case TypeDecl::Ftype: 232 // can pretend that any ftype is `void (*)(void)` 233 out.push_back( new TypeExpr( new FunctionType( Type::Qualifiers(), false ) ) ); 234 break; 235 case TypeDecl::Ttype: 236 assertf( false, "Ttype parameters are not currently allowed as parameters to generic types." ); 237 break; 238 case TypeDecl::Any: 239 assertf( false, "otype parameters handled by baseParam->isComplete()." ); 240 break; 240 241 } 241 242 }
Note: See TracChangeset
for help on using the changeset viewer.