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

Unified Diff: runtime/lib/mirrors.cc

Issue 10834056: Added InterfaceMirror.newInstance(). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « lib/mirrors/mirrors.dart ('k') | 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
===================================================================
--- runtime/lib/mirrors.cc (revision 10017)
+++ runtime/lib/mirrors.cc (working copy)
@@ -906,6 +906,36 @@
}
+void NATIVE_ENTRY_FUNCTION(LocalInterfaceMirrorImpl_invokeConstructor)(
+ Dart_NativeArguments args) {
+ Dart_Handle klass_mirror = Dart_GetNativeArgument(args, 0);
+ Dart_Handle constructor_name = Dart_GetNativeArgument(args, 1);
+ Dart_Handle wrapped_args = Dart_GetNativeArgument(args, 2);
+
+ Dart_Handle klass = UnwrapMirror(klass_mirror);
+ GrowableArray<Dart_Handle> invoke_args;
+ Dart_Handle result = UnwrapArgList(wrapped_args, &invoke_args);
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
+ result = Dart_New(klass,
+ constructor_name,
+ invoke_args.length(),
+ invoke_args.data());
+ if (Dart_IsError(result)) {
+ // Instead of propagating the error from an invoke directly, we
+ // provide reflective access to the error.
+ Dart_PropagateError(CreateMirroredError(result));
+ }
+
+ Dart_Handle wrapped_result = CreateInstanceMirror(result);
+ if (Dart_IsError(wrapped_result)) {
+ Dart_PropagateError(wrapped_result);
+ }
+ Dart_SetReturnValue(args, wrapped_result);
+}
+
+
void HandleMirrorsMessage(Isolate* isolate,
Dart_Port reply_port,
const Instance& message) {
« no previous file with comments | « lib/mirrors/mirrors.dart ('k') | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698