Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.cpp

    r37273c8 rc36a419  
    4141
    4242FunctionDecl::FunctionDecl( const CodeLocation & loc, const std::string & name,
     43        std::vector<ptr<TypeDecl>>&& forall,
    4344        std::vector<ptr<DeclWithType>>&& params, std::vector<ptr<DeclWithType>>&& returns,
    4445        CompoundStmt * stmts, Storage::Classes storage, Linkage::Spec linkage,
    4546        std::vector<ptr<Attribute>>&& attrs, Function::Specs fs, ArgumentFlag isVarArgs )
    46 : FunctionDecl( loc, name, {}, {}, std::move(params), std::move(returns),
    47                 stmts, storage, linkage, std::move(attrs), fs, isVarArgs ) {
     47: DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ),
     48        type_params(std::move(forall)), assertions(),
     49        params(std::move(params)), returns(std::move(returns)), stmts( stmts ) {
     50        FunctionType * ftype = new FunctionType( isVarArgs );
     51        for (auto & param : this->params) {
     52                ftype->params.emplace_back(param->get_type());
     53        }
     54        for (auto & ret : this->returns) {
     55                ftype->returns.emplace_back(ret->get_type());
     56        }
     57        for (auto & tp : this->type_params) {
     58                ftype->forall.emplace_back(new TypeInstType(tp));
     59                for (auto & ap: tp->assertions) {
     60                        ftype->assertions.emplace_back(new VariableExpr(loc, ap));
     61                }
     62        }
     63        this->type = ftype;
    4864}
    4965
Note: See TracChangeset for help on using the changeset viewer.