Changeset af746cc for src/AST/Type.hpp


Ignore:
Timestamp:
Apr 15, 2024, 12:03:53 PM (4 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
dc58e5d
Parents:
d9bad51
Message:

Reimplement the resolution of Enum instance type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Type.hpp

    rd9bad51 raf746cc  
    362362using EnumInstType = SueInstType<EnumDecl>;
    363363
    364 class EnumPosType final : public Type {
     364class EnumAttrType final : public Type {
    365365public:
    366366        readonly<EnumInstType> instance;
    367         const Type * accept( Visitor & v ) const override { return v.visit( this ); }
    368         EnumPosType( const EnumInstType * instance ): instance(instance) {}
     367    EnumAttribute attr;
     368        const Type * accept( Visitor & v ) const override { return v.visit( this ); }
     369        EnumAttrType( const EnumInstType * instance, EnumAttribute attr = EnumAttribute::Posn )
     370                : instance(instance), attr(attr) {}
    369371       
    370 private:
    371         EnumPosType * clone() const override { return new EnumPosType{ *this }; }
     372    bool match( const ast::EnumAttrType * other) const {
     373        return instance->base->name == other->instance->base->name && attr == other->attr;
     374    }
     375private:
     376        EnumAttrType * clone() const override { return new EnumAttrType{ *this }; }
    372377        MUTATE_FRIEND
    373378};
Note: See TracChangeset for help on using the changeset viewer.