Changeset 63d1ebe for src/AST/Type.cpp


Ignore:
Timestamp:
Oct 27, 2022, 11:43:10 AM (23 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
0026d67
Parents:
a167c70c
Message:

Changed GenPoly::TypeVarMap? to use the same key type as ast::TypeSubstitution?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Type.cpp

    ra167c70c r63d1ebe  
    147147// --- TypeInstType
    148148
     149bool TypeInstType::operator==( const TypeInstType & other ) const {
     150        return base == other.base
     151                && formal_usage == other.formal_usage
     152                && expr_id == other.expr_id;
     153}
     154
    149155TypeInstType::TypeInstType( const TypeDecl * b,
    150156        CV::Qualifiers q, std::vector<ptr<Attribute>> && as )
     
    157163
    158164bool TypeInstType::isComplete() const { return base->sized; }
     165
     166std::string TypeInstType::TypeEnvKey::typeString() const {
     167        return std::string("_") + std::to_string(formal_usage)
     168                + "_" + std::to_string(expr_id) + "_" + base->name;
     169}
     170
     171bool TypeInstType::TypeEnvKey::operator==(
     172                const TypeInstType::TypeEnvKey & other ) const {
     173        return base == other.base
     174                && formal_usage == other.formal_usage
     175                && expr_id == other.expr_id;
     176}
     177
     178bool TypeInstType::TypeEnvKey::operator<(
     179                const TypeInstType::TypeEnvKey & other ) const {
     180        // TypeEnvKey ordering is an arbitrary total ordering.
     181        // It doesn't mean anything but allows for a sorting.
     182        if ( base < other.base ) {
     183                return true;
     184        } else if ( other.base < base ) {
     185                return false;
     186        } else if ( formal_usage < other.formal_usage ) {
     187                return true;
     188        } else if ( other.formal_usage < formal_usage ) {
     189                return false;
     190        } else {
     191                return expr_id < other.expr_id;
     192        }
     193}
    159194
    160195// --- TupleType
Note: See TracChangeset for help on using the changeset viewer.