| Index: runtime/vm/dart_api_impl.cc
|
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
|
| index 4ed5a7d85bdd2afd65ba2e66037749fabbce7a8e..de76bdc098fb53e8e0d3597dae10e5d852d75cb2 100644
|
| --- a/runtime/vm/dart_api_impl.cc
|
| +++ b/runtime/vm/dart_api_impl.cc
|
| @@ -3555,12 +3555,16 @@ DART_EXPORT Dart_Handle Dart_New(Dart_Handle clazz,
|
| if (result.IsError()) {
|
| return Api::NewHandle(isolate, result.raw());
|
| }
|
| - // TODO(turnidge): Support redirecting factories.
|
| ASSERT(result.IsFunction());
|
| Function& constructor = Function::Handle(isolate);
|
| constructor ^= result.raw();
|
|
|
| Instance& new_object = Instance::Handle(isolate);
|
| + if (constructor.IsRedirectingFactory()) {
|
| + Type& type = Type::Handle(constructor.RedirectionType());
|
| + cls = type.type_class();
|
| + constructor = constructor.RedirectionTarget();
|
| + }
|
| if (constructor.IsConstructor()) {
|
| // Create the new object.
|
| new_object = Instance::New(cls);
|
|
|