summaryrefslogtreecommitdiff
path: root/src/hir/path.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-05-14 15:06:25 +0800
committerJohn Hodge <tpg@mutabah.net>2016-05-14 15:06:25 +0800
commitd70587b729f9f982e284681d5d16794cf7209e28 (patch)
treed1c539d2bd6d226dea5a7240734e6e495932e272 /src/hir/path.cpp
parentf043a45fd21bab906cafc8964a892a64def65ec9 (diff)
downloadmrust-d70587b729f9f982e284681d5d16794cf7209e28.tar.gz
HIR - Boilerplate code, compiles
Diffstat (limited to 'src/hir/path.cpp')
-rw-r--r--src/hir/path.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/hir/path.cpp b/src/hir/path.cpp
new file mode 100644
index 00000000..23b9c448
--- /dev/null
+++ b/src/hir/path.cpp
@@ -0,0 +1,46 @@
+/*
+ */
+#include <hir/path.hpp>
+#include <hir/type.hpp>
+
+::HIR::SimplePath HIR::SimplePath::operator+(const ::std::string& s) const
+{
+ ::HIR::SimplePath ret(m_crate_name);
+ ret.m_components = m_components;
+
+ ret.m_components.push_back( s );
+
+ return ret;
+}
+namespace HIR {
+ ::std::ostream& operator<<(::std::ostream& os, const ::HIR::SimplePath& x)
+ {
+ if( x.m_crate_name != "" ) {
+ os << "::\"" << x.m_crate_name << "\"";
+ }
+ else if( x.m_components.size() == 0 ) {
+ os << "::";
+ }
+ else {
+ }
+ for(const auto& n : x.m_components)
+ {
+ os << "::" << n;
+ }
+ return os;
+ }
+}
+
+::HIR::GenericPath::GenericPath()
+{
+}
+::HIR::GenericPath::GenericPath(::HIR::SimplePath sp):
+ m_path( mv$(sp) )
+{
+}
+
+::HIR::Path::Path(::HIR::SimplePath sp):
+ m_data( ::HIR::Path::Data::make_Generic(::HIR::GenericPath(mv$(sp))) )
+{
+}
+