Chromium Code Reviews| 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; |
| } |