summaryrefslogtreecommitdiff
path: root/src/ast/path.hpp
diff options
context:
space:
mode:
authorJohn Hodge (sonata) <tpg@mutabah.net>2015-01-15 00:07:26 +0800
committerJohn Hodge (sonata) <tpg@mutabah.net>2015-01-15 00:07:26 +0800
commit801bce6026e86d32b6971463a3aefd38eb3b2f27 (patch)
treebe5330a19fe5e6b3e020a5a62c0b3ac9f59f6df0 /src/ast/path.hpp
parent6e0dfa94d9206d10514c337cee3d704f559381b3 (diff)
downloadmrust-801bce6026e86d32b6971463a3aefd38eb3b2f27.tar.gz
Type aliases added (AST only, no parse yet), need to handle lookups
Diffstat (limited to 'src/ast/path.hpp')
-rw-r--r--src/ast/path.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ast/path.hpp b/src/ast/path.hpp
index f39e133d..c6baf607 100644
--- a/src/ast/path.hpp
+++ b/src/ast/path.hpp
@@ -29,7 +29,7 @@ class PathNode:
::std::string m_name;
::std::vector<TypeRef> m_params;
public:
- PathNode(::std::string name, ::std::vector<TypeRef> args);
+ PathNode(::std::string name, ::std::vector<TypeRef> args = {});
const ::std::string& name() const;
::std::vector<TypeRef>& args() { return m_params; }
const ::std::vector<TypeRef>& args() const;
@@ -109,6 +109,11 @@ public:
m_class(ABSOLUTE),
m_nodes(l)
{}
+ Path(::std::string crate, ::std::vector<PathNode> nodes):
+ m_crate( ::std::move(crate) ),
+ m_class(ABSOLUTE),
+ m_nodes( ::std::move(nodes) )
+ {}
void set_crate(::std::string crate) {
if( m_crate == "" ) {
@@ -119,6 +124,7 @@ public:
static Path add_tailing(const Path& a, const Path& b) {
Path ret(a);
+ ret[ret.size()-1].args() = b[0].args();
for(unsigned int i = 1; i < b.m_nodes.size(); i ++)
ret.m_nodes.push_back(b.m_nodes[i]);
return ret;