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

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

Issue 14178010: Change libraries map to use Uri. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test updated 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') | 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 "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/dart_api_impl.h"
9 #include "vm/bootstrap_natives.h" 9 #include "vm/bootstrap_natives.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 266
267 static Dart_Handle CreateLazyMirror(Dart_Handle target) { 267 static Dart_Handle CreateLazyMirror(Dart_Handle target) {
268 if (Dart_IsNull(target) || Dart_IsError(target)) { 268 if (Dart_IsNull(target) || Dart_IsError(target)) {
269 return target; 269 return target;
270 } 270 }
271 271
272 if (Dart_IsLibrary(target)) { 272 if (Dart_IsLibrary(target)) {
273 Dart_Handle cls_name = NewString("_LazyLibraryMirror"); 273 Dart_Handle cls_name = NewString("_LazyLibraryMirror");
274 Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name); 274 Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
275 Dart_Handle args[] = { Dart_LibraryName(target) }; 275 Dart_Handle args[] = { Dart_LibraryUrl(target) };
276 return Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args); 276 return Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args);
277 } 277 }
278 278
279 if (Dart_IsClass(target)) { 279 if (Dart_IsClass(target)) {
280 if (Dart_ClassIsFunctionType(target)) { 280 if (Dart_ClassIsFunctionType(target)) {
281 Dart_Handle cls_name = NewString("_LazyFunctionTypeMirror"); 281 Dart_Handle cls_name = NewString("_LazyFunctionTypeMirror");
282 Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name); 282 Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
283 283
284 Dart_Handle sig = Dart_ClassGetFunctionTypeSignature(target); 284 Dart_Handle sig = Dart_ClassGetFunctionTypeSignature(target);
285 Dart_Handle return_type = Dart_FunctionReturnType(sig); 285 Dart_Handle return_type = Dart_FunctionReturnType(sig);
286 if (Dart_IsError(return_type)) { 286 if (Dart_IsError(return_type)) {
287 return return_type; 287 return return_type;
288 } 288 }
289 289
290 Dart_Handle args[] = { 290 Dart_Handle args[] = {
291 CreateLazyMirror(return_type), 291 CreateLazyMirror(return_type),
292 CreateParameterMirrorList(sig), 292 CreateParameterMirrorList(sig),
293 }; 293 };
294 return Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args); 294 return Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args);
295 } else { 295 } else {
296 Dart_Handle cls_name = NewString("_LazyTypeMirror"); 296 Dart_Handle cls_name = NewString("_LazyTypeMirror");
297 Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name); 297 Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
298 Dart_Handle lib = Dart_ClassGetLibrary(target); 298 Dart_Handle lib = Dart_ClassGetLibrary(target);
299 Dart_Handle lib_name; 299 Dart_Handle lib_url;
300 if (Dart_IsNull(lib)) { 300 if (Dart_IsNull(lib)) {
301 lib_name = Dart_Null(); 301 lib_url = Dart_Null();
302 } else { 302 } else {
303 lib_name = Dart_LibraryName(lib); 303 lib_url = Dart_LibraryUrl(lib);
304 } 304 }
305 Dart_Handle args[] = { lib_name, Dart_ClassName(target) }; 305 Dart_Handle args[] = { lib_url, Dart_ClassName(target) };
306 return Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args); 306 return Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args);
307 } 307 }
308 } 308 }
309 309
310 if (Dart_IsTypeVariable(target)) { 310 if (Dart_IsTypeVariable(target)) {
311 Dart_Handle var_name = Dart_TypeVariableName(target); 311 Dart_Handle var_name = Dart_TypeVariableName(target);
312 Dart_Handle owner = Dart_TypeVariableOwner(target); 312 Dart_Handle owner = Dart_TypeVariableOwner(target);
313 Dart_Handle owner_mirror = CreateLazyMirror(owner); 313 Dart_Handle owner_mirror = CreateLazyMirror(owner);
314 314
315 Dart_Handle cls_name = NewString("_LazyTypeVariableMirror"); 315 Dart_Handle cls_name = NewString("_LazyTypeVariableMirror");
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 int64_t id64; 864 int64_t id64;
865 Dart_IntegerToInt64(lib_id, &id64); 865 Dart_IntegerToInt64(lib_id, &id64);
866 Dart_Handle lib_url = Dart_GetLibraryURL(id64); 866 Dart_Handle lib_url = Dart_GetLibraryURL(id64);
867 if (Dart_IsError(lib_url)) { 867 if (Dart_IsError(lib_url)) {
868 return lib_url; 868 return lib_url;
869 } 869 }
870 Dart_Handle lib = Dart_LookupLibrary(lib_url); 870 Dart_Handle lib = Dart_LookupLibrary(lib_url);
871 if (Dart_IsError(lib)) { 871 if (Dart_IsError(lib)) {
872 return lib; 872 return lib;
873 } 873 }
874 Dart_Handle lib_key = Dart_LibraryName(lib);
875 Dart_Handle lib_mirror = CreateLibraryMirror(lib); 874 Dart_Handle lib_mirror = CreateLibraryMirror(lib);
876 if (Dart_IsError(lib_mirror)) { 875 if (Dart_IsError(lib_mirror)) {
877 return lib_mirror; 876 return lib_mirror;
878 } 877 }
879 // TODO(turnidge): Check for duplicate library names. 878 result = MapAdd(map, lib_url, lib_mirror);
880 result = MapAdd(map, lib_key, lib_mirror);
881 } 879 }
882 return map; 880 return map;
883 } 881 }
884 882
885 883
886 static Dart_Handle CreateIsolateMirror() { 884 static Dart_Handle CreateIsolateMirror() {
887 Dart_Handle cls_name = NewString("_LocalIsolateMirrorImpl"); 885 Dart_Handle cls_name = NewString("_LocalIsolateMirrorImpl");
888 Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name); 886 Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
889 if (Dart_IsError(cls)) { 887 if (Dart_IsError(cls)) {
890 return cls; 888 return cls;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 } 1280 }
1283 1281
1284 1282
1285 void HandleMirrorsMessage(Isolate* isolate, 1283 void HandleMirrorsMessage(Isolate* isolate,
1286 Dart_Port reply_port, 1284 Dart_Port reply_port,
1287 const Instance& message) { 1285 const Instance& message) {
1288 UNIMPLEMENTED(); 1286 UNIMPLEMENTED();
1289 } 1287 }
1290 1288
1291 } // namespace dart 1289 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698