diff options
author | John Hodge (sonata) <tpg@mutabah.net> | 2015-01-15 00:07:26 +0800 |
---|---|---|
committer | John Hodge (sonata) <tpg@mutabah.net> | 2015-01-15 00:07:26 +0800 |
commit | 801bce6026e86d32b6971463a3aefd38eb3b2f27 (patch) | |
tree | be5330a19fe5e6b3e020a5a62c0b3ac9f59f6df0 /src/ast/path.cpp | |
parent | 6e0dfa94d9206d10514c337cee3d704f559381b3 (diff) | |
download | mrust-801bce6026e86d32b6971463a3aefd38eb3b2f27.tar.gz |
Type aliases added (AST only, no parse yet), need to handle lookups
Diffstat (limited to 'src/ast/path.cpp')
-rw-r--r-- | src/ast/path.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ast/path.cpp b/src/ast/path.cpp index 0bce09c1..e6700696 100644 --- a/src/ast/path.cpp +++ b/src/ast/path.cpp @@ -92,6 +92,21 @@ void Path::resolve(const Crate& root_crate) throw ParseError::Todo("Path::resolve() re-export"); } } + // Type Aliases + { + auto& items = mod->type_aliases(); + auto it = find_named(items, node.name()); + if( it != items.end() ) + { + DEBUG("Type alias <"<<it->data.params()<<"> " << it->data.type()); + if( node.args().size() != it->data.params().size() ) + throw ParseError::Generic("Param count mismatch when referencing type alias"); + // Make a copy of the path, replace params with it, then replace *this? + // - Maybe leave that up to other code? + throw ParseError::Todo("Path::resolve() type alias"); + } + } + // - Functions { auto& items = mod->functions(); |