- Timestamp:
- Apr 4, 2024, 1:40:36 PM (10 months ago)
- Branches:
- master
- Children:
- d9bad51
- Parents:
- 4a72fef
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r4a72fef r1cfe640 457 457 SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, TypeData::builtinTypeNames[builtin] ); 458 458 } // if 459 type = ::addQualifiers( q->type,type );459 type = ::addQualifiers( type, q->type ); 460 460 q->type = nullptr; 461 461 … … 470 470 copySpecifiers( o, copyattr ); 471 471 if ( o->type ) { 472 type = ::addType( o->type,type, o->attributes );472 type = ::addType( type, o->type, o->attributes ); 473 473 o->type = nullptr; 474 474 } // if -
src/Parser/TypeData.cc
r4a72fef r1cfe640 576 576 577 577 // Takes ownership of all arguments, gives ownership of return value. 578 TypeData * addQualifiers( TypeData * ltype, TypeData * rtype) {579 if ( ltype->forall ) {580 if ( rtype->forall || TypeData::Aggregate != rtype->kind ) {581 extend( rtype->forall, ltype->forall );578 TypeData * addQualifiers( TypeData * dst, TypeData * src ) { 579 if ( src->forall ) { 580 if ( dst->forall || TypeData::Aggregate != dst->kind ) { 581 extend( dst->forall, src->forall ); 582 582 } else { 583 extend( rtype->aggregate.params, ltype->forall );583 extend( dst->aggregate.params, src->forall ); 584 584 } 585 ltype->forall = nullptr;585 src->forall = nullptr; 586 586 } 587 587 588 addQualifiersToType( rtype, ltype);589 return rtype;588 addQualifiersToType( dst, src ); 589 return dst; 590 590 } 591 591 … … 657 657 658 658 // Takes ownership of all arguments, gives ownership of return value. 659 TypeData * addType( TypeData * ltype, TypeData * rtype, std::vector<ast::ptr<ast::Attribute>> & attributes ) {660 if ( rtype) {661 addTypeToType( rtype, ltype);662 } else if ( ltype->kind == TypeData::Aggregate ) {659 TypeData * addType( TypeData * dst, TypeData * src, std::vector<ast::ptr<ast::Attribute>> & attributes ) { 660 if ( dst ) { 661 addTypeToType( dst, src ); 662 } else if ( src->kind == TypeData::Aggregate ) { 663 663 // Hide type information aggregate instances. 664 rtype = makeInstance( ltype);665 rtype->aggInst.aggregate->aggregate.attributes.swap( attributes );664 dst = makeInstance( src ); 665 dst->aggInst.aggregate->aggregate.attributes.swap( attributes ); 666 666 } else { 667 rtype = ltype;667 dst = src; 668 668 } // if 669 return rtype;670 } 671 672 TypeData * addType( TypeData * ltype, TypeData * rtype) {669 return dst; 670 } 671 672 TypeData * addType( TypeData * dst, TypeData * src ) { 673 673 std::vector<ast::ptr<ast::Attribute>> attributes; 674 return addType( ltype, rtype, attributes );674 return addType( dst, src, attributes ); 675 675 } 676 676
Note: See TracChangeset
for help on using the changeset viewer.