Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(727)

Unified Diff: src/messages.js

Issue 1100993003: [V8] Use previous token location as EOS token location (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698