Changes in src/AST/Decl.hpp [8a5530c:54e41b3]
- File:
-
- 1 edited
-
src/AST/Decl.hpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
r8a5530c r54e41b3 32 32 namespace ast { 33 33 34 class Attribute;35 class Expr;36 class Init;37 class TypeDecl;38 39 34 /// Base declaration class 40 35 class Decl : public ParseNode { … … 119 114 }; 120 115 121 /// Object declaration `int foo()`122 116 class FunctionDecl : public DeclWithType { 123 117 public: … … 132 126 stmts( stmts ) {} 133 127 134 const Type * get_type() const override ;135 void set_type(Type * t) override ;128 const Type * get_type() const override { return type.get(); } 129 void set_type(Type * t) override { type = strict_dynamic_cast< FunctionType* >( t ); } 136 130 137 131 bool has_body() const { return stmts; } … … 150 144 public: 151 145 ptr<Type> base; 152 std::vector<ptr<TypeDecl>> param eters;146 std::vector<ptr<TypeDecl>> params; 153 147 std::vector<ptr<DeclWithType>> assertions; 154 148 155 149 NamedTypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 156 150 Type* b, Linkage::Spec spec = Linkage::Cforall ) 157 : Decl( loc, name, storage, spec ), base( b ), param eters(), assertions() {}151 : Decl( loc, name, storage, spec ), base( b ), params(), assertions() {} 158 152 159 153 /// Produces a name for the kind of alias … … 190 184 TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b, 191 185 TypeVar::Kind k, bool s, Type* i = nullptr ) 192 : NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == TypeVar::Ttype || s ), 186 : NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == TypeVar::Ttype || s ), 193 187 init( i ) {} 194 188 … … 231 225 public: 232 226 std::vector<ptr<Decl>> members; 233 std::vector<ptr<TypeDecl>> param eters;227 std::vector<ptr<TypeDecl>> params; 234 228 std::vector<ptr<Attribute>> attributes; 235 229 bool body = false; … … 238 232 AggregateDecl( const CodeLocation& loc, const std::string& name, 239 233 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall ) 240 : Decl( loc, name, Storage::Classes{}, linkage ), members(), param eters(),234 : Decl( loc, name, Storage::Classes{}, linkage ), members(), params(), 241 235 attributes( std::move(attrs) ) {} 242 236
Note:
See TracChangeset
for help on using the changeset viewer.