Changeset 8d9d974


Ignore:
Timestamp:
Jan 3, 2023, 4:28:56 PM (15 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
331ee52c
Parents:
d9585291
Message:

Cleaning old box pass for easier translation. Compacting one of the functions to save space.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    rd9585291 r8d9d974  
    424424        namespace {
    425425                std::string makePolyMonoSuffix( FunctionType const * function, const TyVarMap &tyVars ) {
    426                         std::stringstream name;
    427 
    428426                        // NOTE: this function previously used isPolyObj, which failed to produce
    429427                        // the correct thing in some situations. It's not clear to me why this wasn't working.
     
    432430                        // to take those polymorphic types as pointers. Therefore, there can be two different functions
    433431                        // with the same mangled name, so we need to further mangle the names.
     432                        std::stringstream name;
    434433                        for ( DeclarationWithType const * const ret : function->returnVals ) {
    435                                 if ( isPolyType( ret->get_type(), tyVars ) ) {
    436                                         name << "P";
    437                                 } else {
    438                                         name << "M";
    439                                 }
    440                         }
    441                         name << "_";
     434                                name << ( isPolyType( ret->get_type(), tyVars ) ? 'P' : 'M' );
     435                        }
     436                        name << '_';
    442437                        for ( DeclarationWithType const * const arg : function->parameters ) {
    443                                 if ( isPolyType( arg->get_type(), tyVars ) ) {
    444                                         name << "P";
    445                                 } else {
    446                                         name << "M";
    447                                 }
    448                         } // for
     438                                name << ( isPolyType( arg->get_type(), tyVars ) ? 'P' : 'M' );
     439                        }
    449440                        return name.str();
    450441                }
Note: See TracChangeset for help on using the changeset viewer.