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

Unified Diff: runtime/vm/object.cc

Issue 2680303002: Kernel debugging; service tests (Closed)
Patch Set: Changes based on feedback. Also fixed regress_28443_test Created 3 years, 10 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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index d48e22f0eabf636aa3ec226a31b1771cd54b1461..79ff7084582fde2b29482c27eaf00b30dc50d1ba 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -9119,9 +9119,19 @@ void Script::GetTokenLocation(TokenPosition token_pos,
*column = offset - smi.Value() + 1;
}
if (token_len != NULL) {
- // We don't explicitly save this data.
- // TODO(jensj): Load the source and attempt to find it from there.
+ // We don't explicitly save this data: Load the source
+ // and find it from there.
+ const String& source = String::Handle(zone, Source());
+ ASSERT(source.Length() >= offset);
*token_len = 1;
+ for (intptr_t i = offset + 1; i < source.Length(); ++i, ++*token_len) {
+ uint16_t c = source.CharAt(i);
+ if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ||
hausner 2017/02/14 13:16:04 You could use Scanner::IsIdentStartChar() and Scan
jensj 2017/02/14 13:23:54 Kevin suggested the same thing, but the methods ar
+ (c >= '0' && c <= '9') || c == '_' || c == '$') {
+ continue;
+ }
+ break;
+ }
}
return;
}

Powered by Google App Engine
This is Rietveld 408576698