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

Side by Side Diff: runtime/lib/mirrors.cc

Issue 14118011: - Implement reflectClass. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | runtime/lib/mirrors_patch.dart » ('J')
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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_debugger_api.h" 6 #include "include/dart_debugger_api.h"
7 #include "platform/json.h" 7 #include "platform/json.h"
8 #include "vm/dart_api_impl.h"
8 #include "vm/bootstrap_natives.h" 9 #include "vm/bootstrap_natives.h"
9 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
10 #include "vm/exceptions.h" 11 #include "vm/exceptions.h"
11 #include "vm/message.h" 12 #include "vm/message.h"
12 #include "vm/port.h" 13 #include "vm/port.h"
13 #include "vm/resolver.h" 14 #include "vm/resolver.h"
14 15
15 namespace dart { 16 namespace dart {
16 17
17 inline Dart_Handle NewString(const char* str) { 18 inline Dart_Handle NewString(const char* str) {
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 Dart_Handle reflectee = Dart_GetNativeArgument(args, 0); 1067 Dart_Handle reflectee = Dart_GetNativeArgument(args, 0);
1067 Dart_Handle mirror = CreateInstanceMirror(reflectee); 1068 Dart_Handle mirror = CreateInstanceMirror(reflectee);
1068 if (Dart_IsError(mirror)) { 1069 if (Dart_IsError(mirror)) {
1069 Dart_PropagateError(mirror); 1070 Dart_PropagateError(mirror);
1070 } 1071 }
1071 Dart_SetReturnValue(args, mirror); 1072 Dart_SetReturnValue(args, mirror);
1072 Dart_ExitScope(); 1073 Dart_ExitScope();
1073 } 1074 }
1074 1075
1075 1076
1077 void NATIVE_ENTRY_FUNCTION(Mirrors_makeLocalClassMirror)(
1078 Dart_NativeArguments args) {
1079 Dart_EnterScope();
1080 Isolate* isolate = Isolate::Current();
1081 Dart_Handle key = Dart_GetNativeArgument(args, 0);
1082 if (Dart_IsError(key)) {
1083 Dart_PropagateError(key);
1084 }
1085 const Type& type = Api::UnwrapTypeHandle(isolate, key);
1086 const Class& cls = Class::Handle(type.type_class());
1087 Dart_Handle cls_handle = Api::NewHandle(isolate, cls.raw());
1088 if (Dart_IsError(cls_handle)) {
1089 Dart_PropagateError(cls_handle);
1090 }
1091 Dart_Handle name_handle = Api::NewHandle(isolate, cls.Name());
1092 if (Dart_IsError(name_handle)) {
1093 Dart_PropagateError(name_handle);
1094 }
1095 Dart_Handle lib_handle = Api::NewHandle(isolate, cls.library());
1096 if (Dart_IsError(lib_handle)) {
1097 Dart_PropagateError(lib_handle);
1098 }
1099 Dart_Handle lib_mirror = CreateLibraryMirror(lib_handle);
1100 if (Dart_IsError(lib_mirror)) {
1101 Dart_PropagateError(lib_mirror);
1102 }
1103 Dart_Handle result = CreateClassMirror(cls_handle,
1104 name_handle,
1105 lib_handle,
1106 lib_mirror);
1107 if (Dart_IsError(result)) {
1108 Dart_PropagateError(result);
1109 }
1110 Dart_SetReturnValue(args, result);
1111 Dart_ExitScope();
1112 }
1113
1076 void NATIVE_ENTRY_FUNCTION(LocalObjectMirrorImpl_invoke)( 1114 void NATIVE_ENTRY_FUNCTION(LocalObjectMirrorImpl_invoke)(
1077 Dart_NativeArguments args) { 1115 Dart_NativeArguments args) {
1078 Dart_EnterScope(); 1116 Dart_EnterScope();
1079 Dart_Handle mirror = Dart_GetNativeArgument(args, 0); 1117 Dart_Handle mirror = Dart_GetNativeArgument(args, 0);
1080 Dart_Handle member_name = Dart_GetNativeArgument(args, 1); 1118 Dart_Handle member_name = Dart_GetNativeArgument(args, 1);
1081 // The arguments are either simple values or instance mirrors. 1119 // The arguments are either simple values or instance mirrors.
1082 Dart_Handle positional_arguments = Dart_GetNativeArgument(args, 2); 1120 Dart_Handle positional_arguments = Dart_GetNativeArgument(args, 2);
1083 Dart_Handle async = Dart_GetNativeArgument(args, 3); 1121 Dart_Handle async = Dart_GetNativeArgument(args, 3);
1084 1122
1085 Dart_Handle reflectee = UnwrapMirror(mirror); 1123 Dart_Handle reflectee = UnwrapMirror(mirror);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 } 1282 }
1245 1283
1246 1284
1247 void HandleMirrorsMessage(Isolate* isolate, 1285 void HandleMirrorsMessage(Isolate* isolate,
1248 Dart_Port reply_port, 1286 Dart_Port reply_port,
1249 const Instance& message) { 1287 const Instance& message) {
1250 UNIMPLEMENTED(); 1288 UNIMPLEMENTED();
1251 } 1289 }
1252 1290
1253 } // namespace dart 1291 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | runtime/lib/mirrors_patch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698