Changeset e874605 for src/AST/Decl.hpp


Ignore:
Timestamp:
Oct 28, 2022, 3:11:57 PM (22 months ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master
Children:
93d2219
Parents:
77de429
Message:

Add class InlineValueDecl?, which is a Declaration class that works as a placeholder for aggregration value inherited from other aggregration. Disable inline value overwrite.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.hpp

    r77de429 re874605  
    414414};
    415415
     416class InlineValueDecl final : public DeclWithType {
     417public:
     418        ptr<Type> type;
     419
     420        InlineValueDecl( const CodeLocation & loc, const std::string & name, const Type * type,
     421                Storage::Classes storage = {}, Linkage::Spec linkage = Linkage::Cforall,
     422                std::vector< ptr<Attribute> > && attrs = {}, Function::Specs fs = {} )
     423        : DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ), type( type ) {}
     424
     425        const Type * get_type() const override { return type; }
     426        void set_type( const Type * ty ) override { type = ty; }
     427
     428        const DeclWithType * accept( Visitor& v ) const override { return v.visit( this ); }
     429private:
     430        InlineValueDecl * clone() const override { return new InlineValueDecl{ *this }; }
     431        MUTATE_FRIEND
     432};
    416433}
    417434
Note: See TracChangeset for help on using the changeset viewer.