diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-11-28 12:38:53 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-11-28 13:17:33 -0800 |
| commit | fc06114ddfd2bcdbc4f29076c226a7a1d66ea8d6 (patch) | |
| tree | bd9de2c450f23b8ff0e09130ab59d784ace5b5e3 /src/libsyntax/parse/eval.rs | |
| parent | 669fbddc4435a9ab152332df06a7fcca789c8059 (diff) | |
| parent | 8179e268efd86ae5c1bcf21b4f8d4e01eea7c193 (diff) | |
| download | rust-fc06114ddfd2bcdbc4f29076c226a7a1d66ea8d6.tar.gz rust-fc06114ddfd2bcdbc4f29076c226a7a1d66ea8d6.zip | |
Merge remote-tracking branch 'brson/companion' into incoming
Conflicts: src/compiletest/compiletest.rs src/libcargo/cargo.rs src/libcore/core.rs src/librustc/rustc.rs src/librustdoc/rustdoc.rc
Diffstat (limited to 'src/libsyntax/parse/eval.rs')
| -rw-r--r-- | src/libsyntax/parse/eval.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs index 78a47ec09c7..cdfd8a9bcec 100644 --- a/src/libsyntax/parse/eval.rs +++ b/src/libsyntax/parse/eval.rs @@ -5,6 +5,7 @@ use codemap::span; export eval_crate_directives_to_mod; export eval_src_mod; +export eval_src_mod_from_path; type ctx = @{sess: parse::parse_sess, @@ -84,15 +85,23 @@ fn cdir_path_opt(default: ~str, attrs: ~[ast::attribute]) -> ~str { } } -fn eval_src_mod(cx: ctx, prefix: &Path, id: ast::ident, +fn eval_src_mod(cx: ctx, prefix: &Path, outer_attrs: ~[ast::attribute], - sp: span) -> (ast::item_, ~[ast::attribute]) { + id: ast::ident, sp: span + ) -> (ast::item_, ~[ast::attribute]) { let file_path = Path(cdir_path_opt( cx.sess.interner.get(id) + ~".rs", outer_attrs)); - let full_path = if file_path.is_absolute { - copy file_path + eval_src_mod_from_path(cx, prefix, &file_path, outer_attrs, sp) +} + +fn eval_src_mod_from_path(cx: ctx, prefix: &Path, path: &Path, + outer_attrs: ~[ast::attribute], + sp: span + ) -> (ast::item_, ~[ast::attribute]) { + let full_path = if path.is_absolute { + copy *path } else { - prefix.push_many(file_path.components) + prefix.push_many(path.components) }; let p0 = new_sub_parser_from_file(cx.sess, cx.cfg, @@ -121,7 +130,7 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: &Path, items: &mut ~[@ast::item]) { match cdir.node { ast::cdir_src_mod(vis, id, attrs) => { - let (m, mod_attrs) = eval_src_mod(cx, prefix, id, attrs, cdir.span); + let (m, mod_attrs) = eval_src_mod(cx, prefix, attrs, id, cdir.span); let i = mk_item(cx, cdir.span.lo, cdir.span.hi, /* FIXME (#2543) */ copy id, m, vis, mod_attrs); |
