Changes in src/AST/Decl.hpp [e67991f:e0e9a0b]
- File:
-
- 1 edited
-
src/AST/Decl.hpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
re67991f re0e9a0b 87 87 virtual const Type * get_type() const = 0; 88 88 /// Set type of this declaration. May be verified by subclass 89 virtual void set_type( Type *) = 0;89 virtual void set_type( const Type * ) = 0; 90 90 91 91 const DeclWithType * accept( Visitor & v ) const override = 0; … … 102 102 ptr<Expr> bitfieldWidth; 103 103 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, 107 107 std::vector< ptr<Attribute> > && attrs = {}, Function::Specs fs = {} ) 108 108 : DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ), type( type ), … … 110 110 111 111 const Type* get_type() const override { return type; } 112 void set_type( Type * ty ) override { type = ty; }112 void set_type( const Type * ty ) override { type = ty; } 113 113 114 114 const DeclWithType * accept( Visitor& v ) const override { return v.visit( this ); } … … 132 132 133 133 const Type * get_type() const override; 134 void set_type( Type * t) override;134 void set_type( const Type * t ) override; 135 135 136 136 bool has_body() const { return stmts; } … … 149 149 std::vector<ptr<DeclWithType>> assertions; 150 150 151 NamedTypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 152 Type* b, Linkage::Spec spec = Linkage::Cforall ) 151 NamedTypeDecl( 152 const CodeLocation & loc, const std::string & name, Storage::Classes storage, 153 const Type * b, Linkage::Spec spec = Linkage::Cforall ) 153 154 : Decl( loc, name, storage, spec ), base( b ), params(), assertions() {} 154 155 … … 185 186 }; 186 187 187 TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b, 188 TypeVar::Kind k, bool s, Type* i = nullptr ) 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 ) 189 191 : NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == TypeVar::Ttype || s ), 190 192 init( i ) {} … … 321 323 }; 322 324 323 /// With statement `with (...) ...`324 class WithStmt final : public Decl {325 public: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 ); }333 private:334 WithStmt * clone() const override { return new WithStmt{ *this }; }335 MUTATE_FRIEND336 };337 338 325 class AsmDecl : public Decl { 339 326 public:
Note:
See TracChangeset
for help on using the changeset viewer.