diff options
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/common.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/parse/eval.rs | 10 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 35afb79ce63..c0a2f9b9e6e 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -209,6 +209,9 @@ impl parser_common for parser { ret v; } + // FIXME: A lot of callers go through here, only to copy out the T and + // discard the spanned<> wrapper. I feel as though there should be a + // version of this that does not return a spanned result. fn parse_seq<T: copy>(bra: token::token, ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> spanned<[T]> { let lo = self.span.lo; @@ -218,4 +221,4 @@ impl parser_common for parser { self.bump(); ret spanned(lo, hi, result); } -} \ No newline at end of file +} diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs index 98d75499878..254d5cc5d5d 100644 --- a/src/libsyntax/parse/eval.rs +++ b/src/libsyntax/parse/eval.rs @@ -44,7 +44,7 @@ optional suffix then adding the .rs extension. fn parse_companion_mod(cx: ctx, prefix: str, suffix: option<str>) -> ([@ast::view_item], [@ast::item], [ast::attribute]) { - fn companion_file(prefix: str, suffix: option<str>) -> str { + fn companion_file(+prefix: str, suffix: option<str>) -> str { ret alt suffix { option::some(s) { path::connect(prefix, s) } option::none { prefix } @@ -66,8 +66,7 @@ fn parse_companion_mod(cx: ctx, prefix: str, suffix: option<str>) #debug("found companion mod"); let p0 = new_parser_from_file(cx.sess, cx.cfg, modpath, SOURCE_FILE); let inner_attrs = p0.parse_inner_attrs_and_next(); - let first_item_outer_attrs = inner_attrs.next; - let m0 = p0.parse_mod_items(token::EOF, first_item_outer_attrs); + let m0 = p0.parse_mod_items(token::EOF, inner_attrs.next); cx.sess.chpos = p0.reader.chpos; cx.sess.byte_pos = cx.sess.byte_pos + p0.reader.pos; ret (m0.view_items, m0.items, inner_attrs.inner); @@ -102,7 +101,8 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, let first_item_outer_attrs = inner_attrs.next; let m0 = p0.parse_mod_items(token::EOF, first_item_outer_attrs); - let i = p0.mk_item(cdir.span.lo, cdir.span.hi, id, + let i = p0.mk_item(cdir.span.lo, cdir.span.hi, + /* FIXME: bad */ copy id, ast::item_mod(m0), ast::public, mod_attrs); // Thread defids, chpos and byte_pos through the parsers cx.sess.chpos = p0.reader.chpos; @@ -118,7 +118,7 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, let (m0, a0) = eval_crate_directives_to_mod( cx, cdirs, full_path, none); let i = - @{ident: id, + @{ident: /* FIXME: bad */ copy id, attrs: attrs + a0, id: cx.sess.next_id, node: ast::item_mod(m0), |
