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 library mirrors_dart2js; | 5 library mirrors_dart2js; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection' show LinkedHashMap; | 8 import 'dart:collection' show LinkedHashMap; |
9 import 'dart:uri'; | 9 import 'dart:uri'; |
10 | 10 |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 Link<DartType> link = _class.interfaces; | 818 Link<DartType> link = _class.interfaces; |
819 while (!link.isEmpty) { | 819 while (!link.isEmpty) { |
820 var type = _convertTypeToTypeMirror(mirrors, link.head, | 820 var type = _convertTypeToTypeMirror(mirrors, link.head, |
821 mirrors.compiler.types.dynamicType); | 821 mirrors.compiler.types.dynamicType); |
822 list.add(type); | 822 list.add(type); |
823 link = link.tail; | 823 link = link.tail; |
824 } | 824 } |
825 return list; | 825 return list; |
826 } | 826 } |
827 | 827 |
828 bool get isClass => !_class.isInterface(); | 828 bool get isClass => true; |
829 | 829 |
830 bool get isInterface => _class.isInterface(); | 830 bool get isInterface => false; |
831 | 831 |
832 bool get isAbstract => _class.modifiers.isAbstract(); | 832 bool get isAbstract => _class.modifiers.isAbstract(); |
833 | 833 |
834 bool get isOriginalDeclaration => true; | 834 bool get isOriginalDeclaration => true; |
835 | 835 |
836 List<TypeMirror> get typeArguments { | 836 List<TypeMirror> get typeArguments { |
837 throw new UnsupportedError( | 837 throw new UnsupportedError( |
838 'Declarations do not have type arguments'); | 838 'Declarations do not have type arguments'); |
839 } | 839 } |
840 | 840 |
841 List<TypeVariableMirror> get typeVariables { | 841 List<TypeVariableMirror> get typeVariables { |
842 if (_typeVariables == null) { | 842 if (_typeVariables == null) { |
843 _typeVariables = <TypeVariableMirror>[]; | 843 _typeVariables = <TypeVariableMirror>[]; |
844 _class.ensureResolved(mirrors.compiler); | 844 _class.ensureResolved(mirrors.compiler); |
845 for (TypeVariableType typeVariable in _class.typeVariables) { | 845 for (TypeVariableType typeVariable in _class.typeVariables) { |
846 _typeVariables.add( | 846 _typeVariables.add( |
847 new Dart2JsTypeVariableMirror(mirrors, typeVariable)); | 847 new Dart2JsTypeVariableMirror(mirrors, typeVariable)); |
848 } | 848 } |
849 } | 849 } |
850 return _typeVariables; | 850 return _typeVariables; |
851 } | 851 } |
852 | 852 |
853 /** | 853 /** |
854 * Returns the default type for this interface. | 854 * Returns the default type for this interface. |
855 */ | 855 */ |
856 ClassMirror get defaultFactory { | 856 ClassMirror get defaultFactory { |
857 if (_class.defaultClass != null) { | |
858 return new Dart2JsInterfaceTypeMirror(mirrors, _class.defaultClass); | |
859 } | |
860 return null; | 857 return null; |
861 } | 858 } |
862 | 859 |
863 bool operator ==(Object other) { | 860 bool operator ==(Object other) { |
864 if (identical(this, other)) { | 861 if (identical(this, other)) { |
865 return true; | 862 return true; |
866 } | 863 } |
867 if (other is! ClassMirror) { | 864 if (other is! ClassMirror) { |
868 return false; | 865 return false; |
869 } | 866 } |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 * | 1705 * |
1709 * All API in this class is experimental. | 1706 * All API in this class is experimental. |
1710 */ | 1707 */ |
1711 class BackDoor { | 1708 class BackDoor { |
1712 /// Return the compilation units comprising [library]. | 1709 /// Return the compilation units comprising [library]. |
1713 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { | 1710 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { |
1714 return library._element.compilationUnits.toList().map( | 1711 return library._element.compilationUnits.toList().map( |
1715 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); | 1712 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); |
1716 } | 1713 } |
1717 } | 1714 } |
OLD | NEW |