Changeset 93c10de for src/AST/Decl.hpp


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/Decl.hpp

    r78de1e5 r93c10de  
    1010// Created On       : Thu May 9 10:00:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu May  5 12:09:00 2022
    13 // Update Count     : 33
     12// Last Modified On : Thu Nov 24  9:44:00 2022
     13// Update Count     : 34
    1414//
    1515
     
    191191        ptr<Type> init;
    192192
    193         /// Data extracted from a type decl
    194         struct Data {
    195                 Kind kind;
    196                 bool isComplete;
    197 
    198                 Data() : kind( NUMBER_OF_KINDS ), isComplete( false ) {}
    199                 Data( const TypeDecl * d ) : kind( d->kind ), isComplete( d->sized ) {}
    200                 Data( Kind k, bool c ) : kind( k ), isComplete( c ) {}
    201                 Data( const Data & d1, const Data & d2 )
    202                         : kind( d1.kind ), isComplete( d1.isComplete || d2.isComplete ) {}
    203 
    204                 bool operator==( const Data & o ) const { return kind == o.kind && isComplete == o.isComplete; }
    205                 bool operator!=( const Data & o ) const { return !(*this == o); }
    206         };
    207 
    208193        TypeDecl(
    209194                const CodeLocation & loc, const std::string & name, Storage::Classes storage,
     
    225210};
    226211
    227 std::ostream & operator<< ( std::ostream &, const TypeDecl::Data & );
     212/// Data extracted from a TypeDecl.
     213struct TypeData {
     214        TypeDecl::Kind kind;
     215        bool isComplete;
     216
     217        TypeData() : kind( TypeDecl::NUMBER_OF_KINDS ), isComplete( false ) {}
     218        TypeData( const TypeDecl * d ) : kind( d->kind ), isComplete( d->sized ) {}
     219        TypeData( TypeDecl::Kind k, bool c ) : kind( k ), isComplete( c ) {}
     220        TypeData( const TypeData & d1, const TypeData & d2 )
     221                : kind( d1.kind ), isComplete( d1.isComplete || d2.isComplete ) {}
     222
     223        bool operator==( const TypeData & o ) const { return kind == o.kind && isComplete == o.isComplete; }
     224        bool operator!=( const TypeData & o ) const { return !(*this == o); }
     225};
     226
     227std::ostream & operator<< ( std::ostream &, const TypeData & );
    228228
    229229/// C-style typedef `typedef Foo Bar`
Note: See TracChangeset for help on using the changeset viewer.