diff options
author | John Hodge (bugs) <tpg@mutabah.net> | 2014-12-14 10:03:30 +0800 |
---|---|---|
committer | John Hodge (bugs) <tpg@mutabah.net> | 2014-12-14 10:03:30 +0800 |
commit | 5d29fdaa42c638e9420bd3111fb15f3594342354 (patch) | |
tree | d1c3ce2d13751c6ee23b92b44fc7053c681d4a3d /convert/resolve.cpp | |
parent | 605c764a79ed00630967780ee7d434fbaa8aa284 (diff) | |
download | mrust-5d29fdaa42c638e9420bd3111fb15f3594342354.tar.gz |
Parse working, starting on conversion
Diffstat (limited to 'convert/resolve.cpp')
-rw-r--r-- | convert/resolve.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/convert/resolve.cpp b/convert/resolve.cpp new file mode 100644 index 00000000..23d49726 --- /dev/null +++ b/convert/resolve.cpp @@ -0,0 +1,38 @@ +
+#include "../ast/ast.hpp"
+
+// Path resolution checking
+void ResolvePaths(AST::Crate& crate);
+void ResolvePaths_HandleFunction(const AST::Crate& crate, AST::Function& fcn);
+
+class CResolvePaths_NodeVisitor:
+ public AST::NodeVisitor
+{
+ const AST::Crate& m_crate;
+public:
+ CResolvePaths_NodeVisitor(const AST::Crate& crate):
+ m_crate(crate)
+ {
+ }
+
+ void visit(AST::ExprNode::TagNamedValue, AST::ExprNode& node) {
+ // TODO: Convert into a real absolute path
+ }
+};
+
+void ResolvePaths_HandleFunction(const AST::Crate& crate, AST::Function& fcn)
+{
+ fcn.code().visit_nodes( CResolvePaths_NodeVisitor(crate) );
+
+ ResolvePaths_Type(fcn.rettype());
+
+ FOREACH(arg, fcn.args())
+ {
+ ResolvePaths_Type(arg.type());
+ }
+}
+
+void ResolvePaths(AST::Crate& crate)
+{
+ crate.iterate_functions(ResolvePaths_HandleFunction);
+}
|