summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hir/from_ast.cpp2
-rw-r--r--src/hir/hir.hpp20
-rw-r--r--src/hir/path.hpp41
-rw-r--r--src/hir/type.hpp26
4 files changed, 72 insertions, 17 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp
index ca18ed0d..7bf0fa74 100644
--- a/src/hir/from_ast.cpp
+++ b/src/hir/from_ast.cpp
@@ -13,7 +13,7 @@
::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() );
+ auto rootmod = LowerHIR_Module( mv$(crate.m_root_module), ::HIR::SimplePath("") );
return { mv$(rootmod), mv$(macros) };
}
diff --git a/src/hir/hir.hpp b/src/hir/hir.hpp
index 4da80342..7633d916 100644
--- a/src/hir/hir.hpp
+++ b/src/hir/hir.hpp
@@ -14,22 +14,10 @@
#include <macros.hpp> // DAMNIT - Why can't I have it be incomplete
-namespace HIR {
-
-class TypeRef {
-};
+#include <hir/type.hpp>
+#include <hir/path.hpp>
-/// Simple path - Absolute with no generic parameters
-class SimplePath {
-};
-/// Type path - Simple path with one lot of generic params
-class TypePath {
-public:
- SimplePath m_path;
- ::std::vector<TypeRef> m_params;
-};
-class Path {
-};
+namespace HIR {
class Expr {
};
@@ -109,7 +97,7 @@ TAGGED_UNION(TraitValueItem, Static,
struct Trait
{
GenericParams m_params;
- ::std::vector< ::HIR::TypePath > m_parent_traits;
+ ::std::vector< ::HIR::GenericPath > m_parent_traits;
::std::unordered_map< ::std::string, AssociatedType > m_types;
::std::unordered_map< ::std::string, TraitValueItem > m_values;
diff --git a/src/hir/path.hpp b/src/hir/path.hpp
new file mode 100644
index 00000000..e51e3c50
--- /dev/null
+++ b/src/hir/path.hpp
@@ -0,0 +1,41 @@
+
+#ifndef _HIR_PATH_HPP_
+#define _HIR_PATH_HPP_
+#pragma once
+
+#include <common.hpp>
+
+namespace HIR {
+
+class TypeRef;
+
+/// Simple path - Absolute with no generic parameters
+struct SimplePath
+{
+ SimplePath(::std::string crate):
+ m_crate_name( mv$(crate) )
+ {
+ }
+
+ ::std::string m_crate_name;
+ ::std::vector< ::std::string> m_components;
+};
+/// Generic path - Simple path with one lot of generic params
+class GenericPath
+{
+public:
+ SimplePath m_path;
+ ::std::vector<TypeRef> m_params;
+};
+
+class Path
+{
+ // Two possibilities
+ // - UFCS
+ // - Generic path
+};
+
+} // namespace HIR
+
+#endif
+
diff --git a/src/hir/type.hpp b/src/hir/type.hpp
new file mode 100644
index 00000000..0b0ff488
--- /dev/null
+++ b/src/hir/type.hpp
@@ -0,0 +1,26 @@
+
+#ifndef _HIR_TYPE_HPP_
+#define _HIR_TYPE_HPP_
+#pragma once
+
+#include <hir/path.hpp>
+
+namespace HIR {
+
+class TypeRef
+{
+ // Options:
+ // - Primitive
+ // - Parameter
+ // - Path
+
+ // - Array
+ // - Tuple
+ // - Borrow
+ // - Pointer
+};
+
+} // namespace HIR
+
+#endif
+