diff options
-rw-r--r-- | src/hir_conv/constant_evaluation.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/hir_conv/constant_evaluation.hpp b/src/hir_conv/constant_evaluation.hpp new file mode 100644 index 00000000..dff6e73e --- /dev/null +++ b/src/hir_conv/constant_evaluation.hpp @@ -0,0 +1,33 @@ +/* + */ +#include <hir/hir.hpp> + +namespace HIR { + + +struct Evaluator +{ + class Newval + { + public: + virtual ::HIR::Path new_static(::HIR::TypeRef type, ::HIR::Literal value) = 0; + }; + + const 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 + |