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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 return mirrors.libraries[libraryName]; | 704 return mirrors.libraries[libraryName]; |
705 } | 705 } |
706 | 706 |
707 final Symbol libraryName; | 707 final Symbol libraryName; |
708 } | 708 } |
709 | 709 |
710 class _LocalLibraryMirrorImpl extends _LocalObjectMirrorImpl | 710 class _LocalLibraryMirrorImpl extends _LocalObjectMirrorImpl |
711 implements LibraryMirror { | 711 implements LibraryMirror { |
712 _LocalLibraryMirrorImpl(ref, | 712 _LocalLibraryMirrorImpl(ref, |
713 String simpleName, | 713 String simpleName, |
714 this.url, | 714 String url, |
715 Map<String, Mirror> members) | 715 Map<String, Mirror> members) |
716 : this.simpleName = _s(simpleName), | 716 : this.simpleName = _s(simpleName), |
717 this.members = _convertStringToSymbolMap(members), | 717 this.members = _convertStringToSymbolMap(members), |
| 718 this.uri = Uri.parse(url), |
718 super(ref); | 719 super(ref); |
719 | 720 |
720 final Symbol simpleName; | 721 final Symbol simpleName; |
721 | 722 |
722 // The simple name and the qualified name are the same for a library. | 723 // The simple name and the qualified name are the same for a library. |
723 Symbol get qualifiedName => simpleName; | 724 Symbol get qualifiedName => simpleName; |
724 | 725 |
725 // Always null for libraries. | 726 // Always null for libraries. |
726 final DeclarationMirror owner = null; | 727 final DeclarationMirror owner = null; |
727 | 728 |
728 // Always false for libraries. | 729 // Always false for libraries. |
729 final bool isPrivate = false; | 730 final bool isPrivate = false; |
730 | 731 |
731 // Always false for libraries. | 732 // Always false for libraries. |
732 final bool isTopLevel = false; | 733 final bool isTopLevel = false; |
733 | 734 |
734 SourceLocation get location { | 735 SourceLocation get location { |
735 throw new UnimplementedError( | 736 throw new UnimplementedError( |
736 'LibraryMirror.location is not implemented'); | 737 'LibraryMirror.location is not implemented'); |
737 } | 738 } |
738 | 739 |
739 final String url; | 740 final Uri uri; |
740 final Map<Symbol, Mirror> members; | 741 final Map<Symbol, Mirror> members; |
741 | 742 |
742 Map<Symbol, ClassMirror> _classes = null; | 743 Map<Symbol, ClassMirror> _classes = null; |
743 Map<Symbol, MethodMirror> _functions = null; | 744 Map<Symbol, MethodMirror> _functions = null; |
744 Map<Symbol, MethodMirror> _getters = null; | 745 Map<Symbol, MethodMirror> _getters = null; |
745 Map<Symbol, MethodMirror> _setters = null; | 746 Map<Symbol, MethodMirror> _setters = null; |
746 Map<Symbol, VariableMirror> _variables = null; | 747 Map<Symbol, VariableMirror> _variables = null; |
747 | 748 |
748 Map<Symbol, ClassMirror> get classes { | 749 Map<Symbol, ClassMirror> get classes { |
749 if (_classes == null) { | 750 if (_classes == null) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 | 1002 |
1002 // Creates a new local mirror for some Object. | 1003 // Creates a new local mirror for some Object. |
1003 static InstanceMirror reflect(Object reflectee) { | 1004 static InstanceMirror reflect(Object reflectee) { |
1004 return makeLocalInstanceMirror(reflectee); | 1005 return makeLocalInstanceMirror(reflectee); |
1005 } | 1006 } |
1006 | 1007 |
1007 static ClassMirror reflectClass(Type reflectee) { | 1008 static ClassMirror reflectClass(Type reflectee) { |
1008 throw new UnimplementedError('reflectClass is not implemented'); | 1009 throw new UnimplementedError('reflectClass is not implemented'); |
1009 } | 1010 } |
1010 } | 1011 } |
OLD | NEW |