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

Unified Diff: runtime/lib/mirrors.cc

Issue 25097005: Make ClassMirror.newInstance deal with reordered etc type arguments for redirecting factories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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/vm/dart_api_impl.cc » ('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 8e71843f3658c413e8296de0b1773510289887db..d5c08cea4d798790261ca849c0597afa92ec0149 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -1410,11 +1410,31 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 5) {
UNREACHABLE();
}
+ ASSERT(!type.IsNull());
+ AbstractTypeArguments& type_arguments =
+ AbstractTypeArguments::Handle(type.arguments());
+
Class& redirected_klass = Class::Handle(klass.raw());
Function& redirected_constructor = Function::Handle(lookup_constructor.raw());
if (lookup_constructor.IsRedirectingFactory()) {
ClassFinalizer::ResolveRedirectingFactory(klass, lookup_constructor);
- Type& type = Type::Handle(lookup_constructor.RedirectionType());
+ Type& redirect_type = Type::Handle(lookup_constructor.RedirectionType());
+
+ if (!redirect_type.IsInstantiated()) {
+ // The type arguments of the redirection type are instantiated from the
+ // type arguments of the type reflected by the class mirror.
+ Error& malformed_error = Error::Handle();
+ redirect_type ^= redirect_type.InstantiateFrom(type_arguments,
+ &malformed_error);
+ if (!malformed_error.IsNull()) {
+ ThrowInvokeError(malformed_error);
+ UNREACHABLE();
+ }
+ }
+
+ type = redirect_type.raw();
+ type_arguments = redirect_type.arguments();
+
redirected_constructor = lookup_constructor.RedirectionTarget();
ASSERT(!redirected_constructor.IsNull());
redirected_klass = type.type_class();
@@ -1451,10 +1471,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 5) {
UNREACHABLE();
}
- ASSERT(!type.IsNull());
- const AbstractTypeArguments& type_arguments =
- AbstractTypeArguments::Handle(type.arguments());
-
Instance& new_object = Instance::Handle();
if (redirected_constructor.IsConstructor()) {
// Constructors get the uninitialized object and a constructor phase. Note
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698