summaryrefslogtreecommitdiff
path: root/src/hir/expr_state.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2018-09-22 16:25:01 +0800
committerJohn Hodge <tpg@ucc.asn.au>2018-09-22 16:25:01 +0800
commit5c63b46f8dca1d65c1906c77169555229ab07412 (patch)
tree5580be06c7a535c3b46bdc3ae9f766697aa1158b /src/hir/expr_state.hpp
parentdd4e3c887fa2eef2db6fa2795d4283636a1cc26e (diff)
downloadmrust-5c63b46f8dca1d65c1906c77169555229ab07412.tar.gz
All - Generate MIR for constant evaluation (has too many const_cast calls, but it's less ugly)
- Also includes some MIR optimisation changes to reduce some compile times (hopefully) - Removed duplicated MIR consteval and now-unused HIR consteval
Diffstat (limited to 'src/hir/expr_state.hpp')
-rw-r--r--src/hir/expr_state.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/hir/expr_state.hpp b/src/hir/expr_state.hpp
new file mode 100644
index 00000000..5491b4d3
--- /dev/null
+++ b/src/hir/expr_state.hpp
@@ -0,0 +1,42 @@
+/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * hir/expr_state.hpp
+ * - Extra state for expression pointers
+ */
+#pragma once
+#include <hir/hir.hpp>
+
+namespace HIR {
+
+struct ExprState
+{
+ ::HIR::SimplePath m_mod_path;
+ const ::HIR::Module& m_module;
+
+ ::HIR::GenericParams* m_impl_generics;
+ ::HIR::GenericParams* m_item_generics;
+
+ ::std::vector< ::std::pair< const ::HIR::SimplePath*, const ::HIR::Trait* > > m_traits;
+
+ enum class Stage {
+ Created,
+ TypecheckRequest,
+ Typecheck,
+ MirRequest,
+ Mir,
+ };
+ mutable Stage stage;
+
+ ExprState(const ::HIR::Module& mod_ptr, ::HIR::SimplePath mod_path):
+ m_mod_path(::std::move(mod_path)),
+ m_module(mod_ptr),
+ m_impl_generics(nullptr),
+ m_item_generics(nullptr),
+ stage(Stage::Created)
+ {
+ }
+};
+
+}