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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 return mirrors.libraries[libraryName]; | 765 return mirrors.libraries[libraryName]; |
766 } | 766 } |
767 | 767 |
768 final Symbol libraryName; | 768 final Symbol libraryName; |
769 } | 769 } |
770 | 770 |
771 class _LocalLibraryMirrorImpl extends _LocalObjectMirrorImpl | 771 class _LocalLibraryMirrorImpl extends _LocalObjectMirrorImpl |
772 implements LibraryMirror { | 772 implements LibraryMirror { |
773 _LocalLibraryMirrorImpl(ref, | 773 _LocalLibraryMirrorImpl(ref, |
774 String simpleName, | 774 String simpleName, |
775 this.url, | 775 String url, |
776 Map<String, Mirror> members) | 776 Map<String, Mirror> members) |
777 : this.simpleName = _s(simpleName), | 777 : this.simpleName = _s(simpleName), |
778 this.members = _convertStringToSymbolMap(members), | 778 this.members = _convertStringToSymbolMap(members), |
| 779 this.uri = Uri.parse(url), |
779 super(ref); | 780 super(ref); |
780 | 781 |
781 final Symbol simpleName; | 782 final Symbol simpleName; |
782 | 783 |
783 // The simple name and the qualified name are the same for a library. | 784 // The simple name and the qualified name are the same for a library. |
784 Symbol get qualifiedName => simpleName; | 785 Symbol get qualifiedName => simpleName; |
785 | 786 |
786 // Always null for libraries. | 787 // Always null for libraries. |
787 final DeclarationMirror owner = null; | 788 final DeclarationMirror owner = null; |
788 | 789 |
789 // Always false for libraries. | 790 // Always false for libraries. |
790 final bool isPrivate = false; | 791 final bool isPrivate = false; |
791 | 792 |
792 // Always false for libraries. | 793 // Always false for libraries. |
793 final bool isTopLevel = false; | 794 final bool isTopLevel = false; |
794 | 795 |
795 SourceLocation get location { | 796 SourceLocation get location { |
796 throw new UnimplementedError( | 797 throw new UnimplementedError( |
797 'LibraryMirror.location is not implemented'); | 798 'LibraryMirror.location is not implemented'); |
798 } | 799 } |
799 | 800 |
800 final String url; | 801 final Uri uri; |
801 final Map<Symbol, Mirror> members; | 802 final Map<Symbol, Mirror> members; |
802 | 803 |
803 Map<Symbol, ClassMirror> _classes = null; | 804 Map<Symbol, ClassMirror> _classes = null; |
804 Map<Symbol, MethodMirror> _functions = null; | 805 Map<Symbol, MethodMirror> _functions = null; |
805 Map<Symbol, MethodMirror> _getters = null; | 806 Map<Symbol, MethodMirror> _getters = null; |
806 Map<Symbol, MethodMirror> _setters = null; | 807 Map<Symbol, MethodMirror> _setters = null; |
807 Map<Symbol, VariableMirror> _variables = null; | 808 Map<Symbol, VariableMirror> _variables = null; |
808 | 809 |
809 Map<Symbol, ClassMirror> get classes { | 810 Map<Symbol, ClassMirror> get classes { |
810 if (_classes == null) { | 811 if (_classes == null) { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 } | 1067 } |
1067 | 1068 |
1068 // Creates a new local ClassMirror. | 1069 // Creates a new local ClassMirror. |
1069 static ClassMirror makeLocalClassMirror(Type key) | 1070 static ClassMirror makeLocalClassMirror(Type key) |
1070 native "Mirrors_makeLocalClassMirror"; | 1071 native "Mirrors_makeLocalClassMirror"; |
1071 | 1072 |
1072 static ClassMirror reflectClass(Type key) { | 1073 static ClassMirror reflectClass(Type key) { |
1073 return makeLocalClassMirror(key); | 1074 return makeLocalClassMirror(key); |
1074 } | 1075 } |
1075 } | 1076 } |
OLD | NEW |