Index: runtime/lib/mirrors.cc |
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc |
index 9f5c7634be0c0632f0e48c6c48bd960eb6d520c7..d82cf7d2bc984f27df5c7e05a9c34e73fde0d89f 100644 |
--- a/runtime/lib/mirrors.cc |
+++ b/runtime/lib/mirrors.cc |
@@ -2037,6 +2037,13 @@ DEFINE_NATIVE_ENTRY(MethodMirror_return_type, 2) { |
DEFINE_NATIVE_ENTRY(MethodMirror_source, 1) { |
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
const Function& func = Function::Handle(ref.GetFunctionReferent()); |
+ if (func.IsImplicitConstructor() || func.IsSignatureFunction()) { |
+ // We may need to handle more cases when the restrictions on mixins are |
+ // relaxed. In particular we might start associating some source with the |
+ // forwarding constructors when it becomes possible to specify a particular |
+ // constructor from the mixin to use. |
+ return Instance::null(); |
+ } |
const Script& script = Script::Handle(func.script()); |
const TokenStream& stream = TokenStream::Handle(script.tokens()); |
const TokenStream::Iterator tkit(stream, func.end_token_pos()); |
@@ -2059,7 +2066,10 @@ DEFINE_NATIVE_ENTRY(MethodMirror_source, 1) { |
String::Handle(func.name()).Equals("<anonymous closure>"))) { // Case 3. |
last_tok_len = 0; |
} |
- return script.GetSnippet(from_line, from_col, to_line, to_col + last_tok_len); |
+ const Instance& result = Instance::Handle( |
+ script.GetSnippet(from_line, from_col, to_line, to_col + last_tok_len)); |
+ ASSERT(!result.IsNull()); |
+ return result.raw(); |
} |