Index: runtime/vm/dart_api_impl.cc |
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
index 176407caae7a6dd0e8a6775f9733a5fd1846a192..4714bbf349d287ae19cd3700ad6a986d74f3461b 100644 |
--- a/runtime/vm/dart_api_impl.cc |
+++ b/runtime/vm/dart_api_impl.cc |
@@ -2818,6 +2818,23 @@ DART_EXPORT Dart_Handle Dart_New(Dart_Handle clazz, |
} |
+DART_EXPORT Dart_Handle Dart_Allocate(Dart_Handle clazz) { |
+ Isolate* isolate = Isolate::Current(); |
+ DARTSCOPE(isolate); |
+ CHECK_CALLBACK_STATE(isolate); |
+ Object& result = Object::Handle(isolate); |
siva
2013/06/18 00:52:14
result doesn't seem to be used at all.
|
+ |
+ // Get the class to instantiate. |
+ Class& cls = |
+ Class::Handle(isolate, Api::UnwrapClassHandle(isolate, clazz).raw()); |
siva
2013/06/18 00:52:14
const Class& cls = Api::UnwrapClassHandle(isolate,
|
+ if (cls.IsNull()) { |
+ RETURN_TYPE_ERROR(isolate, clazz, Class); |
+ } |
+ |
+ return Api::NewHandle(isolate, Instance::New(cls)); |
+} |
siva
2013/06/18 00:52:14
We would also need a test for this in dart_api_imp
vsm
2013/06/19 14:55:12
I rewrote this code to also accept Types, and I ad
|
+ |
+ |
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, |
Dart_Handle name, |
int number_of_arguments, |