From 41b7d6d74da54b80419ab093303dd356fae957ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Tue, 18 Jan 2011 15:23:11 -0500 Subject: One last refactoring of the import handling: * Create an import resolving stage. Currently this involves a copy of the ast, we can probably revisit this once we revisit doing full copies of the ast in general. * Don't repeat work. Once we resolve a import, put it on a hash table and use it next time we are asked for it. This solves a O(n^2) behaviour in degenerated cases. * Once import resolution is done, the target of an import is stored on the import itself. --- src/comp/front/parser.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/comp/front/parser.rs') diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index c44da8f1..0e8d1dc7 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -1704,7 +1704,8 @@ impure fn parse_rest_import_name(parser p, ast.ident id) -> @ast.view_item { identifiers += i; } p.bump(); - auto import_decl = ast.view_item_import(identifiers, p.next_def_id()); + auto import_decl = ast.view_item_import(identifiers, p.next_def_id(), + none[ast.def]); ret @spanned(lo, hi, import_decl); } -- cgit v1.2.3