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

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
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 mirror = Dart_GetNativeArgument(args, 0);
+ Dart_Handle constructor_name = Dart_GetNativeArgument(args, 1);
+ Dart_Handle raw_invoke_args = Dart_GetNativeArgument(args, 2);
Ivan Posva 2012/07/30 17:03:28 I know that you are following the precedent set in
rmacnak 2012/07/30 17:48:22 For now I switched to 'wrapped_args' to agree with
+
+ Dart_Handle reflectee = UnwrapMirror(mirror);
+ GrowableArray<Dart_Handle> invoke_args;
+ Dart_Handle result = UnwrapArgList(raw_invoke_args, &invoke_args);
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
+ result = Dart_New(reflectee,
+ 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) {

Powered by Google App Engine
This is Rietveld 408576698