Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 3dedb122c75e8c391bdff8eaf24c1a96cdf18ef6..67ccd31014249127b5aede7c3cc6be3cdfc7af5e 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -11352,13 +11352,11 @@ |
if (cache->IsLineTerminatorSequence(current, next)) line_ends->Add(i); |
} |
- if (include_ending_line) { |
- // Include one character beyond the end of script. The rewriter uses that |
- // position for the implicit return statement. |
+ if (src_len > 0 && cache->IsLineTerminatorSequence(src[src_len - 1], 0)) { |
+ line_ends->Add(src_len - 1); |
+ } else if (include_ending_line) { |
+ // Even if the last line misses a line end, it is counted. |
line_ends->Add(src_len); |
- } else if (src_len > 0 && |
- cache->IsLineTerminatorSequence(src[src_len - 1], 0)) { |
- line_ends->Add(src_len - 1); |
} |
} |