Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.cpp

    rc7f9f53 rc36a419  
    2121
    2222#include "Common/Eval.h"       // for eval
    23 #include "Common/SemanticError.h"
    2423
    2524#include "Fwd.hpp"             // for UniqueId
     
    4241
    4342FunctionDecl::FunctionDecl( const CodeLocation & loc, const std::string & name,
     43        std::vector<ptr<TypeDecl>>&& forall,
    4444        std::vector<ptr<DeclWithType>>&& params, std::vector<ptr<DeclWithType>>&& returns,
    4545        CompoundStmt * stmts, Storage::Classes storage, Linkage::Spec linkage,
    4646        std::vector<ptr<Attribute>>&& attrs, Function::Specs fs, ArgumentFlag isVarArgs )
    47 : FunctionDecl( loc, name, {}, {}, std::move(params), std::move(returns),
    48                 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;
    4964}
    5065
Note: See TracChangeset for help on using the changeset viewer.