Inject the view_items for core in the right place, add comment documenting why the wrong place was wrong.

This commit is contained in:
Graydon Hoare 2011-12-07 13:29:04 -08:00
parent 799690bea0
commit e056ffa17d
2 changed files with 10 additions and 5 deletions

View File

@ -123,12 +123,10 @@ fn spanned<copy T>(x: T) -> @ast::spanned<T> {
let vi1 = spanned(ast::view_item_use("core", [], n1));
let vi2 = spanned(ast::view_item_import_glob(@["core"], n2));
let cd1 = spanned(ast::cdir_view_item(vi1));
let cd2 = spanned(ast::cdir_view_item(vi2));
let vis = [vi1, vi2] + crate.node.module.view_items;
let cdirs = [cd1, cd2] + crate.node.directives;
ret @{node: {directives: cdirs with crate.node} with *crate }
ret @{node: {module: { view_items: vis with crate.node.module }
with crate.node} with *crate }
}

View File

@ -60,7 +60,14 @@
tag crate_directive_ {
cdir_src_mod(ident, [attribute]);
cdir_dir_mod(ident, [@crate_directive], [attribute]);
// NB: cdir_view_item is *not* processed by the rest of the compiler; the
// attached view_items are sunk into the crate's module during parsing,
// and processed (resolved, imported, etc.) there. This tag-variant exists
// only to preserve the view items in order in case we decide to
// pretty-print crates in the future.
cdir_view_item(@view_item);
cdir_syntax(@path);
}