Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.hpp

    re0e9a0b re67991f  
    8787        virtual const Type * get_type() const = 0;
    8888        /// Set type of this declaration. May be verified by subclass
    89         virtual void set_type( const Type * ) = 0;
     89        virtual void set_type(Type *) = 0;
    9090
    9191        const DeclWithType * accept( Visitor & v ) const override = 0;
     
    102102        ptr<Expr> bitfieldWidth;
    103103
    104         ObjectDecl( const CodeLocation & loc, const std::string & name, const Type * type, 
    105                 const Init * init = nullptr, Storage::Classes storage = {}, 
    106                 Linkage::Spec linkage = Linkage::C, const Expr * bitWd = nullptr, 
     104        ObjectDecl( const CodeLocation & loc, const std::string & name, const Type * type,
     105                const Init * init = nullptr, Storage::Classes storage = {},
     106                Linkage::Spec linkage = Linkage::C, const Expr * bitWd = nullptr,
    107107                std::vector< ptr<Attribute> > && attrs = {}, Function::Specs fs = {} )
    108108        : DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ), type( type ),
     
    110110
    111111        const Type* get_type() const override { return type; }
    112         void set_type( const Type * ty ) override { type = ty; }
     112        void set_type( Type * ty ) override { type = ty; }
    113113
    114114        const DeclWithType * accept( Visitor& v ) const override { return v.visit( this ); }
     
    132132
    133133        const Type * get_type() const override;
    134         void set_type( const Type * t ) override;
     134        void set_type(Type * t) override;
    135135
    136136        bool has_body() const { return stmts; }
     
    149149        std::vector<ptr<DeclWithType>> assertions;
    150150
    151         NamedTypeDecl(
    152                 const CodeLocation & loc, const std::string & name, Storage::Classes storage,
    153                 const Type * b, Linkage::Spec spec = Linkage::Cforall )
     151        NamedTypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage,
     152                Type* b, Linkage::Spec spec = Linkage::Cforall )
    154153        : Decl( loc, name, storage, spec ), base( b ), params(), assertions() {}
    155154
     
    186185        };
    187186
    188         TypeDecl(
    189                 const CodeLocation & loc, const std::string & name, Storage::Classes storage,
    190                 const Type * b, TypeVar::Kind k, bool s, const Type * i = nullptr )
     187        TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b,
     188                TypeVar::Kind k, bool s, Type* i = nullptr )
    191189        : NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == TypeVar::Ttype || s ),
    192190          init( i ) {}
     
    323321};
    324322
     323/// With statement `with (...) ...`
     324class WithStmt final : public Decl {
     325public:
     326        std::vector<ptr<Expr>> exprs;
     327        ptr<Stmt> stmt;
     328
     329        WithStmt( const CodeLocation & loc, std::vector<ptr<Expr>> && exprs, const Stmt * stmt )
     330        : Decl(loc, "", Storage::Auto, Linkage::Cforall), exprs(std::move(exprs)), stmt(stmt) {}
     331
     332        const Decl * accept( Visitor & v ) const override { return v.visit( this ); }
     333private:
     334        WithStmt * clone() const override { return new WithStmt{ *this }; }
     335        MUTATE_FRIEND
     336};
     337
    325338class AsmDecl : public Decl {
    326339public:
Note: See TracChangeset for help on using the changeset viewer.