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

Unified Diff: runtime/vm/object.cc

Issue 2680303002: Kernel debugging; service tests (Closed)
Patch Set: Correct file offset when calling on field (mind the rebase) 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
« no previous file with comments | « runtime/vm/kernel_to_il.cc ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 7482015638326648d80173606445df517d1fcd6b..17b551828d283cc99f50bd3a48ba13d5c228d39b 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -9224,9 +9224,18 @@ 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;
+ if (Scanner::IsIdentStartChar(source.CharAt(offset))) {
+ for (intptr_t i = offset + 1; i < source.Length(); ++i, ++*token_len) {
hausner 2017/03/06 16:58:55 I find this hard to read, since the for loop more
jensj 2017/03/07 08:43:40 Done.
+ if (!Scanner::IsIdentChar(source.CharAt(i))) {
+ break;
+ }
+ }
+ }
}
return;
}
« no previous file with comments | « runtime/vm/kernel_to_il.cc ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698