Ignore:
Timestamp:
Nov 24, 2022, 11:01:37 AM (19 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
82a90d4
Parents:
78de1e5
Message:

Minimal changes to pull out nested types, TypeInstType::TypeEnvKey? and TypeDecl::Data (now TypeData?) from there parent types. Although they do connect to the parent types they were nested in they are used on their own most of the time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/TypeEnvironment.hpp

    r78de1e5 r93c10de  
    7979
    8080/// Set of open variables
    81 using OpenVarSet = std::unordered_map< TypeInstType::TypeEnvKey, TypeDecl::Data >;
     81using OpenVarSet = std::unordered_map< TypeEnvKey, TypeData >;
    8282
    8383/// Merges one set of open vars into another
     
    9595/// they bind to.
    9696struct EqvClass {
    97         std::unordered_set< TypeInstType::TypeEnvKey > vars;
     97        std::unordered_set< TypeEnvKey > vars;
    9898        ptr<Type> bound;
    9999        bool allowWidening;
    100         TypeDecl::Data data;
     100        TypeData data;
    101101
    102102        EqvClass() : vars(), bound(), allowWidening( true ), data() {}
     
    111111
    112112        /// Singleton class constructor from substitution
    113         EqvClass( const TypeInstType::TypeEnvKey & v, const Type * b )
     113        EqvClass( const TypeEnvKey & v, const Type * b )
    114114        : vars{ v }, bound( b ), allowWidening( false ), data( TypeDecl::Dtype, false ) {}
    115115
    116116        /// Single-var constructor (strips qualifiers from bound type)
    117         EqvClass( const TypeInstType::TypeEnvKey & v, const Type * b, bool w, const TypeDecl::Data & d )
     117        EqvClass( const TypeEnvKey & v, const Type * b, bool w, const TypeData & d )
    118118        : vars{ v }, bound( b ), allowWidening( w ), data( d ) {
    119119                reset_qualifiers( bound );
     
    121121
    122122        /// Double-var constructor
    123         EqvClass( const TypeInstType::TypeEnvKey & v, const TypeInstType::TypeEnvKey & u, bool w, const TypeDecl::Data & d )
     123        EqvClass( const TypeEnvKey & v, const TypeEnvKey & u, bool w, const TypeData & d )
    124124        : vars{ v, u }, bound(), allowWidening( w ), data( d ) {}
    125125
     
    137137public:
    138138        /// Finds the equivalence class containing a variable; nullptr for none such
    139         const EqvClass * lookup( const TypeInstType::TypeEnvKey & var ) const;
     139        const EqvClass * lookup( const TypeEnvKey & var ) const;
    140140
    141141        /// Add a new equivalence class for each type variable
     
    181181        /// needed. Returns false on failure.
    182182        bool bindVar(
    183                 const TypeInstType * typeInst, const Type * bindTo, const TypeDecl::Data & data,
     183                const TypeInstType * typeInst, const Type * bindTo, const TypeData & data,
    184184                AssertionSet & need, AssertionSet & have, const OpenVarSet & openVars,
    185185                ResolvExpr::WidenMode widen, const SymbolTable & symtab );
     
    188188        /// classes if needed. Returns false on failure.
    189189        bool bindVarToVar(
    190                 const TypeInstType * var1, const TypeInstType * var2, TypeDecl::Data && data,
     190                const TypeInstType * var1, const TypeInstType * var2, TypeData && data,
    191191                AssertionSet & need, AssertionSet & have, const OpenVarSet & openVars,
    192192                ResolvExpr::WidenMode widen, const SymbolTable & symtab );
     
    213213
    214214        /// Private lookup API; returns array index of string, or env.size() for not found
    215         ClassList::iterator internal_lookup( const TypeInstType::TypeEnvKey & );
     215        ClassList::iterator internal_lookup( const TypeEnvKey & );
    216216};
    217217
Note: See TracChangeset for help on using the changeset viewer.