Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 8df9f9333e007d2bbbb11a80e977f1c75be8093a..a69bd2fd35b9bb85c164a229f7786e602a623fd5 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') || |
|
Kevin Millikin (Google)
2017/02/08 15:37:53
This is Scanner::IsIdentChar(c), isn't it?
jensj
2017/02/13 14:04:17
Yes, but that's private.
|
| + (c >= '0' && c <= '9') || c == '_' || c == '$') { |
| + continue; |
| + } |
| + break; |
| + } |
| } |
| return; |
| } |