OLD | NEW |
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 // VM-specific implementation of the dart:mirrors library. | 5 // VM-specific implementation of the dart:mirrors library. |
6 | 6 |
7 // These values are allowed to be passed directly over the wire. | 7 // These values are allowed to be passed directly over the wire. |
8 bool _isSimpleValue(var value) { | 8 bool _isSimpleValue(var value) { |
9 return (value == null || value is num || value is String || value is bool); | 9 return (value == null || value is num || value is String || value is bool); |
10 } | 10 } |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 static _apply(ref, positionalArguments) | 333 static _apply(ref, positionalArguments) |
334 native 'LocalClosureMirrorImpl_apply'; | 334 native 'LocalClosureMirrorImpl_apply'; |
335 } | 335 } |
336 | 336 |
337 class _LazyTypeMirror { | 337 class _LazyTypeMirror { |
338 _LazyTypeMirror(this.libraryName, this.typeName) {} | 338 _LazyTypeMirror(this.libraryName, this.typeName) {} |
339 | 339 |
340 TypeMirror resolve(MirrorSystem mirrors) { | 340 TypeMirror resolve(MirrorSystem mirrors) { |
341 if (libraryName == null) { | 341 if (libraryName == null) { |
342 if (typeName == 'Dynamic') { | 342 // TODO(turnidge): Remove support for 'Dynamic'. |
| 343 if ((typeName == 'dynamic') || (typeName == 'Dynamic')) { |
343 return mirrors.dynamicType; | 344 return mirrors.dynamicType; |
344 } else if (typeName == 'void') { | 345 } else if (typeName == 'void') { |
345 return mirrors.voidType; | 346 return mirrors.voidType; |
346 } else { | 347 } else { |
347 throw new NotImplementedException( | 348 throw new NotImplementedException( |
348 "Mirror for type '$typeName' is not implemented"); | 349 "Mirror for type '$typeName' is not implemented"); |
349 } | 350 } |
350 } | 351 } |
351 var resolved = mirrors.libraries[libraryName].members[typeName]; | 352 var resolved = mirrors.libraries[libraryName].members[typeName]; |
352 if (resolved == null) { | 353 if (resolved == null) { |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 | 964 |
964 // Creates a new local InstanceMirror | 965 // Creates a new local InstanceMirror |
965 static InstanceMirror makeLocalInstanceMirror(Object reflectee) | 966 static InstanceMirror makeLocalInstanceMirror(Object reflectee) |
966 native 'Mirrors_makeLocalInstanceMirror'; | 967 native 'Mirrors_makeLocalInstanceMirror'; |
967 | 968 |
968 // Creates a new local mirror for some Object. | 969 // Creates a new local mirror for some Object. |
969 static InstanceMirror reflect(Object reflectee) { | 970 static InstanceMirror reflect(Object reflectee) { |
970 return makeLocalInstanceMirror(reflectee); | 971 return makeLocalInstanceMirror(reflectee); |
971 } | 972 } |
972 } | 973 } |
OLD | NEW |