diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2011-12-07 13:29:04 -0800 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-12-07 13:33:00 -0800 |
| commit | e056ffa17d8dad336a3f8380d3d23f282f7f067d (patch) | |
| tree | f2f226ffc1ada86f906ae96363d9cdfc0de7cc78 | |
| parent | 799690bea0dbcf427bf7a9a813fec163eedf217d (diff) | |
Inject the view_items for core in the right place, add comment documenting why the wrong place was wrong.
| -rw-r--r-- | src/comp/driver/rustc.rs | 8 | ||||
| -rw-r--r-- | src/comp/syntax/ast.rs | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index dbcc704cbe5..03086444419 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -123,12 +123,10 @@ fn inject_libcore_reference(sess: session::session, 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 } } diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index a501d083aae..be3bf5b5ee0 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -60,7 +60,14 @@ type crate_ = 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); } |
