Chromium Code Reviews| Index: runtime/lib/mirrors.cc |
| diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc |
| index e98997a2e1476e9f497b0f94fe38a5e1ecab81d7..f8cc5c8b2082a5734a4f6156cb0300c0fa644d38 100644 |
| --- a/runtime/lib/mirrors.cc |
| +++ b/runtime/lib/mirrors.cc |
| @@ -2045,6 +2045,12 @@ DEFINE_NATIVE_ENTRY(MethodMirror_source, 1) { |
| } |
| const Script& script = Script::Handle(func.script()); |
| const TokenStream& stream = TokenStream::Handle(script.tokens()); |
| + if (!script.HasSource()) { |
| + // When source is not available, avoid printing the whole token stream and |
| + // doing expensive position calculations. |
|
hausner
2014/02/10 16:49:53
Maybe mention in the comment why it makes no sense
|
| + return stream.GenerateSource(func.token_pos(), func.end_token_pos() + 1); |
| + } |
| + |
| const TokenStream::Iterator tkit(stream, func.end_token_pos()); |
| intptr_t from_line; |
| intptr_t from_col; |