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

Side by Side 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, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/mirrors/mirrors.dart ('k') | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "platform/json.h" 7 #include "platform/json.h"
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "include/dart_debugger_api.h" 9 #include "include/dart_debugger_api.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } 899 }
900 900
901 Dart_Handle wrapped_result = CreateInstanceMirror(result); 901 Dart_Handle wrapped_result = CreateInstanceMirror(result);
902 if (Dart_IsError(wrapped_result)) { 902 if (Dart_IsError(wrapped_result)) {
903 Dart_PropagateError(wrapped_result); 903 Dart_PropagateError(wrapped_result);
904 } 904 }
905 Dart_SetReturnValue(args, wrapped_result); 905 Dart_SetReturnValue(args, wrapped_result);
906 } 906 }
907 907
908 908
909 void NATIVE_ENTRY_FUNCTION(LocalInterfaceMirrorImpl_invokeConstructor)(
910 Dart_NativeArguments args) {
911 Dart_Handle klass_mirror = Dart_GetNativeArgument(args, 0);
912 Dart_Handle constructor_name = Dart_GetNativeArgument(args, 1);
913 Dart_Handle wrapped_args = Dart_GetNativeArgument(args, 2);
914
915 Dart_Handle klass = UnwrapMirror(klass_mirror);
916 GrowableArray<Dart_Handle> invoke_args;
917 Dart_Handle result = UnwrapArgList(wrapped_args, &invoke_args);
918 if (Dart_IsError(result)) {
919 Dart_PropagateError(result);
920 }
921 result = Dart_New(klass,
922 constructor_name,
923 invoke_args.length(),
924 invoke_args.data());
925 if (Dart_IsError(result)) {
926 // Instead of propagating the error from an invoke directly, we
927 // provide reflective access to the error.
928 Dart_PropagateError(CreateMirroredError(result));
929 }
930
931 Dart_Handle wrapped_result = CreateInstanceMirror(result);
932 if (Dart_IsError(wrapped_result)) {
933 Dart_PropagateError(wrapped_result);
934 }
935 Dart_SetReturnValue(args, wrapped_result);
936 }
937
938
909 void HandleMirrorsMessage(Isolate* isolate, 939 void HandleMirrorsMessage(Isolate* isolate,
910 Dart_Port reply_port, 940 Dart_Port reply_port,
911 const Instance& message) { 941 const Instance& message) {
912 UNIMPLEMENTED(); 942 UNIMPLEMENTED();
913 } 943 }
914 944
915 } // namespace dart 945 } // namespace dart
OLDNEW
« 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