about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2011-07-13 14:00:11 -0400
committerBrian Anderson <banderson@mozilla.com>2011-07-16 15:56:31 -0700
commita5ac8f16db58f586b868d8612e38f01bdf2dd97e (patch)
treeed1a5927eb48998cd90ce254a3c3b288a642cda8 /src/comp/syntax
parent63598248e4a7db9b62ba4d36d18b2769044e1fa1 (diff)
downloadrust-a5ac8f16db58f586b868d8612e38f01bdf2dd97e.tar.gz
rust-a5ac8f16db58f586b868d8612e38f01bdf2dd97e.zip
Use the actual start position of the file in the codemap rather than the position of the first newline.
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/codemap.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs
index f1c4b1fb034..1a627619bd3 100644
--- a/src/comp/syntax/codemap.rs
+++ b/src/comp/syntax/codemap.rs
@@ -63,9 +63,7 @@ fn emit_diagnostic(&option::t[span] sp, &str msg, &str kind, u8 color,
     alt (sp) {
         case (some(?ssp)) {
             ss = span_to_str(ssp, cm);
-
             maybe_lines = some(span_to_lines(ssp, cm));
-
         }
         case (none) { }
     }
@@ -170,12 +168,12 @@ fn span_to_lines(span sp, codemap::codemap cm) -> @file_lines {
 }
 
 fn get_line(filemap fm, int line, &str file) -> str {
-    let uint begin = fm.lines.(line) - fm.lines.(0);
+    let uint begin = fm.lines.(line) - fm.start_pos;
     let uint end;
     if ((line as uint) + 1u >= ivec::len(fm.lines)) {
         end = str::byte_len(file);
     } else {
-        end = fm.lines.(line + 1) - fm.lines.(0);
+        end = fm.lines.(line + 1) - fm.start_pos;
     }
     ret str::slice(file, begin, end);
 }