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

Unified Diff: runtime/observatory/lib/src/service/object.dart

Issue 1187953005: Fix last column calculation in scanForLocalVariableLocations (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/service/object.dart
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index d3b87062b7f7a1f43d2041dff6ac69d7322a89e5..3a28eba367583fa1e301352e88c63e148e81f805 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -2548,7 +2548,7 @@ class Script extends ServiceObject with Coverage {
return r;
}
- final lastColumn = tokenToCol(endTokenPos);
+ var lastColumn = tokenToCol(endTokenPos);
if (lastColumn == null) {
return r;
}
@@ -2572,6 +2572,11 @@ class Script extends ServiceObject with Coverage {
if (line == lastLine) {
// Only one line.
if (!getLine(line).isTrivialLine) {
+ // TODO(johnmccutchan): end token pos -> column can lie for snapshotted
+ // code. e.g.:
+ // io_sink.dart source line 23 ends at column 39
+ // io_sink.dart snapshotted source line 23 ends at column 35.
+ lastColumn = math.min(getLine(line).text.length, lastColumn);
lineContents = getLine(line).text.substring(column, lastColumn - 1);
return scanLineForLocalVariableLocations(pattern,
name,
@@ -2608,6 +2613,11 @@ class Script extends ServiceObject with Coverage {
// Scan last line.
if (!getLine(line).isTrivialLine) {
+ // TODO(johnmccutchan): end token pos -> column can lie for snapshotted
+ // code. e.g.:
+ // io_sink.dart source line 23 ends at column 39
+ // io_sink.dart snapshotted source line 23 ends at column 35.
+ lastColumn = math.min(getLine(line).text.length, lastColumn);
lineContents = getLine(line).text.substring(0, lastColumn - 1);
r.addAll(
scanLineForLocalVariableLocations(pattern,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698