summaryrefslogtreecommitdiff
path: root/src/hir/from_ast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hir/from_ast.cpp')
-rw-r--r--src/hir/from_ast.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp
new file mode 100644
index 00000000..ca18ed0d
--- /dev/null
+++ b/src/hir/from_ast.cpp
@@ -0,0 +1,24 @@
+
+#include "hir.hpp"
+#include <ast/ast.hpp>
+#include <ast/crate.hpp>
+
+::HIR::Module LowerHIR_Module(::AST::Module module, ::HIR::SimplePath path);
+
+/// \brief Converts the AST into HIR format
+///
+/// - Removes all possibility for unexpanded macros
+/// - Performs name resolution and partial UFCS conversion? (TODO: This should be done on the AST, as it requires two passes with state)
+/// - Performs desugaring of for/if-let/while-let/...
+::HIR::Crate LowerHIR_FromAST(::AST::Crate crate)
+{
+ ::std::unordered_map< ::std::string, MacroRules > macros;
+ auto rootmod = LowerHIR_Module( mv$(crate.m_root_module), ::HIR::SimplePath() );
+ return { mv$(rootmod), mv$(macros) };
+}
+
+::HIR::Module LowerHIR_Module(::AST::Module module, ::HIR::SimplePath path)
+{
+ throw ::std::runtime_error("");
+}
+