Ignore:
Timestamp:
Apr 4, 2024, 1:40:36 PM (3 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
d9bad51
Parents:
4a72fef
Message:

One more bit of clean-up, improving some names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypeData.cc

    r4a72fef r1cfe640  
    576576
    577577// 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 );
     578TypeData * addQualifiers( TypeData * dst, TypeData * src ) {
     579        if ( src->forall ) {
     580                if ( dst->forall || TypeData::Aggregate != dst->kind ) {
     581                        extend( dst->forall, src->forall );
    582582                } else {
    583                         extend( rtype->aggregate.params, ltype->forall );
     583                        extend( dst->aggregate.params, src->forall );
    584584                }
    585                 ltype->forall = nullptr;
     585                src->forall = nullptr;
    586586        }
    587587
    588         addQualifiersToType( rtype, ltype );
    589         return rtype;
     588        addQualifiersToType( dst, src );
     589        return dst;
    590590}
    591591
     
    657657
    658658// 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 ) {
     659TypeData * 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 ) {
    663663                // 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 );
    666666        } else {
    667                 rtype = ltype;
     667                dst = src;
    668668        } // if
    669         return rtype;
    670 }
    671 
    672 TypeData * addType( TypeData * ltype, TypeData * rtype ) {
     669        return dst;
     670}
     671
     672TypeData * addType( TypeData * dst, TypeData * src ) {
    673673        std::vector<ast::ptr<ast::Attribute>> attributes;
    674         return addType( ltype, rtype, attributes );
     674        return addType( dst, src, attributes );
    675675}
    676676
Note: See TracChangeset for help on using the changeset viewer.