From 801bce6026e86d32b6971463a3aefd38eb3b2f27 Mon Sep 17 00:00:00 2001 From: "John Hodge (sonata)" Date: Thu, 15 Jan 2015 00:07:26 +0800 Subject: Type aliases added (AST only, no parse yet), need to handle lookups --- src/ast/path.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/ast/path.cpp') 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 <"<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(); -- cgit v1.2.3