Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 2da9eb62c4b0b5c7f5ef255576b59967b0fba013..ba952d5715308620f370ed36ba6aca7ac25b9389 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -3474,12 +3474,28 @@ TokenPosition Class::ComputeEndTokenPos() const { |
| if (is_synthesized_class() || IsMixinApplication() || IsTopLevel()) { |
| return token_pos(); |
| } |
| + |
|
Kevin Millikin (Google)
2017/01/12 13:43:04
I'm not a fan of these inserted blank lines (also
jensj
2017/01/13 10:14:44
That's probably me in an attempt to block stuff to
|
| Zone* zone = Thread::Current()->zone(); |
| const Script& scr = Script::Handle(zone, script()); |
| ASSERT(!scr.IsNull()); |
| if (scr.kind() == RawScript::kKernelTag) { |
| - return TokenPosition::kMinSource; |
| + TokenPosition largest_seen = token_pos(); |
| + |
| + // Walk through all functions and get their end_tokens to find the classes |
| + // "end token". |
| + // TODO(jensj): Should probably walk though all fields as well. |
| + Function& function = Function::Handle(zone); |
| + const Array& arr = Array::Handle(functions()); |
| + for (int i = 0; i < arr.Length(); i++) { |
| + function ^= arr.At(i); |
| + if (function.script() == script()) { |
| + if (largest_seen < function.end_token_pos()) { |
| + largest_seen = function.end_token_pos(); |
| + } |
| + } |
| + } |
| + return TokenPosition(largest_seen); |
| } |
| const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens()); |