Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Unified Diff: runtime/lib/mirrors.cc

Issue 138383007: Adjust assertions in MethodMirror.source not to expect source for implicit constructors or signatur… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: note Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698