summaryrefslogtreecommitdiff
path: root/src/hir_conv/constant_evaluation.hpp
blob: a5fd7050a16830c30250deb5c2e5ffe80dfba190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 */
#include <hir/hir.hpp>

namespace HIR {


struct Evaluator
{
    class Newval
    {
    public:
        virtual ::HIR::Path new_static(::HIR::TypeRef type, ::HIR::Literal value) = 0;
    };

    Span    root_span;
    StaticTraitResolve  resolve;
    Newval& nvs;

    Evaluator(const Span& sp, const ::HIR::Crate& crate, Newval& nvs):
        root_span(sp),
        resolve(crate),
        nvs( nvs )
    {
    }

    ::HIR::Literal evaluate_constant(const ::HIR::ItemPath& ip, const ::HIR::ExprPtr& expr, ::HIR::TypeRef exp, MonomorphState ms={});

    ::HIR::Literal evaluate_constant_mir(const ::HIR::ItemPath& ip, const ::MIR::Function& fcn, MonomorphState ms, ::HIR::TypeRef exp, ::std::vector< ::HIR::Literal> args);
};

} // namespace HIR