Index: runtime/vm/debugger_api_impl.cc |
diff --git a/runtime/vm/debugger_api_impl.cc b/runtime/vm/debugger_api_impl.cc |
index 58e7794c1604669728169f87510b67e64f78bf7f..5baae815a7ebaeed73678ebc02e08caabcb081a6 100644 |
--- a/runtime/vm/debugger_api_impl.cc |
+++ b/runtime/vm/debugger_api_impl.cc |
@@ -746,40 +746,7 @@ DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo( |
} |
const GrowableObjectArray& info = |
- GrowableObjectArray::Handle(GrowableObjectArray::New()); |
- const String& source = String::Handle(script.Source()); |
- const String& key = Symbols::Empty(); |
- const Object& line_separator = Object::Handle(); |
- const TokenStream& tkns = TokenStream::Handle(script.tokens()); |
- int line_offset = script.line_offset(); |
- ASSERT(!tkns.IsNull()); |
- TokenStream::Iterator tkit(tkns, 0); |
- int current_line = -1; |
- Scanner s(source, key); |
- s.Scan(); |
- while (s.current_token().kind != Token::kEOS) { |
- ASSERT(tkit.IsValid()); |
- ASSERT(s.current_token().kind == tkit.CurrentTokenKind()); |
- int token_line = s.current_token().position.line; |
- if (token_line != current_line) { |
- // emit line |
- info.Add(line_separator); |
- info.Add(Smi::Handle(Smi::New(token_line + line_offset))); |
- current_line = token_line; |
- } |
- // TODO(hausner): Could optimize here by not reporting tokens |
- // that will never be a location used by the debugger, e.g. |
- // braces, semicolons, most keywords etc. |
- info.Add(Smi::Handle(Smi::New(tkit.CurrentPosition()))); |
- int column = s.current_token().position.column; |
- // On the first line of the script we must add the column offset. |
- if (token_line == 1) { |
- column += script.col_offset(); |
- } |
- info.Add(Smi::Handle(Smi::New(column))); |
- s.Scan(); |
- tkit.Advance(); |
- } |
+ GrowableObjectArray::Handle(script.GenerateLineNumberArray()); |
return Api::NewHandle(isolate, Array::MakeArray(info)); |
} |