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 import "dart:collection" show UnmodifiableListView, UnmodifiableMapView; | 7 import "dart:collection" show UnmodifiableListView, UnmodifiableMapView; |
8 | 8 |
9 final emptyList = new UnmodifiableListView([]); | 9 final emptyList = new UnmodifiableListView([]); |
10 final emptyMap = new UnmodifiableMapView({}); | 10 final emptyMap = new UnmodifiableMapView({}); |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 | 580 |
581 class _LocalClassMirror extends _LocalObjectMirror | 581 class _LocalClassMirror extends _LocalObjectMirror |
582 implements ClassMirror { | 582 implements ClassMirror { |
583 final Type _reflectedType; | 583 final Type _reflectedType; |
584 Symbol _simpleName; | 584 Symbol _simpleName; |
585 DeclarationMirror _owner; | 585 DeclarationMirror _owner; |
586 final bool isAbstract; | 586 final bool isAbstract; |
587 final bool _isGeneric; | 587 final bool _isGeneric; |
588 final bool _isMixinAlias; | 588 final bool _isMixinAlias; |
589 final bool _isGenericDeclaration; | 589 final bool _isGenericDeclaration; |
| 590 final bool isEnum; |
590 Type _instantiator; | 591 Type _instantiator; |
591 | 592 |
592 _LocalClassMirror(reflectee, | 593 _LocalClassMirror(reflectee, |
593 reflectedType, | 594 reflectedType, |
594 String simpleName, | 595 String simpleName, |
595 this._owner, | 596 this._owner, |
596 this.isAbstract, | 597 this.isAbstract, |
597 this._isGeneric, | 598 this._isGeneric, |
598 this._isMixinAlias, | 599 this._isMixinAlias, |
599 this._isGenericDeclaration) | 600 this._isGenericDeclaration, |
| 601 this.isEnum) |
600 : this._simpleName = _s(simpleName), | 602 : this._simpleName = _s(simpleName), |
601 this._reflectedType = reflectedType, | 603 this._reflectedType = reflectedType, |
602 this._instantiator = reflectedType, | 604 this._instantiator = reflectedType, |
603 super(reflectee); | 605 super(reflectee); |
604 | 606 |
605 | 607 |
606 bool get hasReflectedType => !_isGenericDeclaration; | 608 bool get hasReflectedType => !_isGenericDeclaration; |
607 Type get reflectedType { | 609 Type get reflectedType { |
608 if (!hasReflectedType) { | 610 if (!hasReflectedType) { |
609 throw new UnsupportedError( | 611 throw new UnsupportedError( |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 static _ClassMirror_type_variables(reflectee) | 964 static _ClassMirror_type_variables(reflectee) |
963 native "ClassMirror_type_variables"; | 965 native "ClassMirror_type_variables"; |
964 | 966 |
965 static _computeTypeArguments(reflectee) | 967 static _computeTypeArguments(reflectee) |
966 native "ClassMirror_type_arguments"; | 968 native "ClassMirror_type_arguments"; |
967 } | 969 } |
968 | 970 |
969 class _LocalFunctionTypeMirror extends _LocalClassMirror | 971 class _LocalFunctionTypeMirror extends _LocalClassMirror |
970 implements FunctionTypeMirror { | 972 implements FunctionTypeMirror { |
971 _LocalFunctionTypeMirror(reflectee, reflectedType) | 973 _LocalFunctionTypeMirror(reflectee, reflectedType) |
972 : super(reflectee, reflectedType, null, null, false, false, false, false); | 974 : super(reflectee, reflectedType, null, null, false, false, false, false,
false); |
973 | 975 |
974 bool get _isAnonymousMixinApplication => false; | 976 bool get _isAnonymousMixinApplication => false; |
975 | 977 |
976 // FunctionTypeMirrors have a simpleName generated from their signature. | 978 // FunctionTypeMirrors have a simpleName generated from their signature. |
977 Symbol _simpleName = null; | 979 Symbol _simpleName = null; |
978 Symbol get simpleName { | 980 Symbol get simpleName { |
979 if (_simpleName == null) { | 981 if (_simpleName == null) { |
980 _simpleName = _s(_makeSignatureString(returnType, parameters)); | 982 _simpleName = _s(_makeSignatureString(returnType, parameters)); |
981 } | 983 } |
982 return _simpleName; | 984 return _simpleName; |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 if (typeMirror == null) { | 1688 if (typeMirror == null) { |
1687 typeMirror = makeLocalTypeMirror(key); | 1689 typeMirror = makeLocalTypeMirror(key); |
1688 _instanitationCache[key] = typeMirror; | 1690 _instanitationCache[key] = typeMirror; |
1689 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1691 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
1690 _declarationCache[key] = typeMirror; | 1692 _declarationCache[key] = typeMirror; |
1691 } | 1693 } |
1692 } | 1694 } |
1693 return typeMirror; | 1695 return typeMirror; |
1694 } | 1696 } |
1695 } | 1697 } |
OLD | NEW |