diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-11-16 14:22:09 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-11-16 14:22:09 -0800 |
| commit | 4a5b28ff0cae0e48d8e3e0cf45728e438390d7ee (patch) | |
| tree | 9c7d0bed694a4b1252eb69010f61f27dadc82887 /src/libsyntax/parse | |
| parent | 2374154ded19a247be0053d71f5bcdd22b95462a (diff) | |
| download | rust-4a5b28ff0cae0e48d8e3e0cf45728e438390d7ee.tar.gz rust-4a5b28ff0cae0e48d8e3e0cf45728e438390d7ee.zip | |
Stop tracking CodeMap offsets in the parse session. Big simplification
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/parse/eval.rs | 14 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index e3ac3e7dcbb..2a8bbe3b6d8 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -292,7 +292,8 @@ fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler, {cmnts: ~[cmnt], lits: ~[lit]} { let src = @str::from_bytes(srdr.read_whole_stream()); let itr = parse::token::mk_fake_ident_interner(); - let filemap = @FileMap::new(path, src, BytePos(0)); + let cm = CodeMap::new(); + let filemap = cm.new_filemap(path, src); let rdr = lexer::new_low_level_string_reader( span_diagnostic, filemap, itr); diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs index 47dbc0cd6ee..f08f1954464 100644 --- a/src/libsyntax/parse/eval.rs +++ b/src/libsyntax/parse/eval.rs @@ -1,4 +1,3 @@ -use parse::update_parse_sess_position; use parser::{Parser, SOURCE_FILE}; use attr::parser_attr; @@ -63,11 +62,10 @@ fn parse_companion_mod(cx: ctx, prefix: &Path, suffix: &Option<Path>) let modpath = &companion_file(prefix, suffix); if file_exists(modpath) { debug!("found companion mod"); - let (p0, r0) = new_parser_etc_from_file(cx.sess, cx.cfg, - modpath, SOURCE_FILE); + let p0 = new_parser_from_file(cx.sess, cx.cfg, + modpath, SOURCE_FILE); let inner_attrs = p0.parse_inner_attrs_and_next(); let m0 = p0.parse_mod_items(token::EOF, inner_attrs.next); - update_parse_sess_position(&cx.sess, &r0); return (m0.view_items, m0.items, inner_attrs.inner); } else { return (~[], ~[], ~[]); @@ -93,9 +91,9 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: &Path, } else { prefix.push_many(file_path.components) }; - let (p0, r0) = - new_parser_etc_from_file(cx.sess, cx.cfg, - &full_path, SOURCE_FILE); + let p0 = + new_parser_from_file(cx.sess, cx.cfg, + &full_path, SOURCE_FILE); let inner_attrs = p0.parse_inner_attrs_and_next(); let mod_attrs = vec::append(attrs, inner_attrs.inner); let first_item_outer_attrs = inner_attrs.next; @@ -104,8 +102,6 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: &Path, let i = p0.mk_item(cdir.span.lo, cdir.span.hi, /* FIXME (#2543) */ copy id, ast::item_mod(m0), vis, mod_attrs); - // Thread defids, chpos and byte_pos through the parsers - update_parse_sess_position(&cx.sess, &r0); items.push(i); } ast::cdir_dir_mod(vis, id, cdirs, attrs) => { |
