Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.hpp

    r8a5530c r54e41b3  
    3232namespace ast {
    3333
    34 class Attribute;
    35 class Expr;
    36 class Init;
    37 class TypeDecl;
    38 
    3934/// Base declaration class
    4035class Decl : public ParseNode {
     
    119114};
    120115
    121 /// Object declaration `int foo()`
    122116class FunctionDecl : public DeclWithType {
    123117public:
     
    132126          stmts( stmts ) {}
    133127
    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 ); }
    136130
    137131        bool has_body() const { return stmts; }
     
    150144public:
    151145        ptr<Type> base;
    152         std::vector<ptr<TypeDecl>> parameters;
     146        std::vector<ptr<TypeDecl>> params;
    153147        std::vector<ptr<DeclWithType>> assertions;
    154148
    155149        NamedTypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage,
    156150                Type* b, Linkage::Spec spec = Linkage::Cforall )
    157         : Decl( loc, name, storage, spec ), base( b ), parameters(), assertions() {}
     151        : Decl( loc, name, storage, spec ), base( b ), params(), assertions() {}
    158152
    159153        /// Produces a name for the kind of alias
     
    190184        TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b,
    191185                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 ), 
    193187          init( i ) {}
    194188
     
    231225public:
    232226        std::vector<ptr<Decl>> members;
    233         std::vector<ptr<TypeDecl>> parameters;
     227        std::vector<ptr<TypeDecl>> params;
    234228        std::vector<ptr<Attribute>> attributes;
    235229        bool body = false;
     
    238232        AggregateDecl( const CodeLocation& loc, const std::string& name,
    239233                std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall )
    240         : Decl( loc, name, Storage::Classes{}, linkage ), members(), parameters(),
     234        : Decl( loc, name, Storage::Classes{}, linkage ), members(), params(),
    241235          attributes( std::move(attrs) ) {}
    242236
Note: See TracChangeset for help on using the changeset viewer.