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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 12496011: Added support for redirecting factories in dart api. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Restored comment. Created 7 years, 9 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 | « runtime/tests/vm/vm.status ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698