Index: src/messages.js |
diff --git a/src/messages.js b/src/messages.js |
index e997061fc47416b04992090cef81a6fd8d7d7452..034237466ee3b05d6dd6351475488eb88235f6e5 100644 |
--- a/src/messages.js |
+++ b/src/messages.js |
@@ -401,10 +401,15 @@ function ScriptLineFromPosition(position) { |
var line_ends = this.line_ends; |
// We'll never find invalid positions so bail right away. |
- if (position > line_ends[upper]) { |
+ if (position - 1 > line_ends[upper]) { |
yurys
2015/04/27 09:23:15
I'd rather v8 highlighted position of the last tok
|
return -1; |
} |
+ // Process EOS token |
+ if (position > line_ends[upper]) { |
+ return upper; |
+ } |
+ |
// This means we don't have to safe-guard indexing line_ends[i - 1]. |
if (position <= line_ends[0]) { |
return 0; |