- File:
-
- 1 edited
-
src/GenPoly/InstantiateGeneric.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/InstantiateGeneric.cc
r373d0b5 r4e7a4e6 453 453 return false; 454 454 } 455 456 AggregateDecl * getAggr( Type * t ) { 457 if ( StructInstType * inst = dynamic_cast< StructInstType * >( t ) ) { 458 return inst->baseStruct; 459 } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( t ) ) { 460 return inst->baseUnion; 461 } 462 assertf( false, "Non-aggregate type: %s", toString( t ).c_str() ); 463 } 455 464 } 456 465 … … 460 469 if ( isGenericType( memberExpr->aggregate->result ) ) { 461 470 // find the location of the member 462 AggregateDecl * aggr = memberExpr->aggregate->result->getAggr();471 AggregateDecl * aggr = getAggr( memberExpr->aggregate->result ); 463 472 std::list< Declaration * > & members = aggr->members; 464 473 memberIndex = std::distance( members.begin(), std::find( members.begin(), members.end(), memberExpr->member ) ); … … 470 479 if ( memberIndex != -1 ) { 471 480 // using the location from the generic type, find the member in the instantiation and rebuild the member expression 472 AggregateDecl * aggr = memberExpr->aggregate->result->getAggr();481 AggregateDecl * aggr = getAggr( memberExpr->aggregate->result ); 473 482 assertf( memberIndex < (int)aggr->members.size(), "Instantiation somehow has fewer members than the generic type." ); 474 483 Declaration * member = *std::next( aggr->members.begin(), memberIndex );
Note:
See TracChangeset
for help on using the changeset viewer.