| 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"; | 7 import "dart:collection"; |
| 8 | 8 |
| 9 final emptyList = new UnmodifiableListView([]); | 9 final emptyList = new UnmodifiableListView([]); |
| 10 final emptyMap = new _UnmodifiableMapView({}); | 10 final emptyMap = new _UnmodifiableMapView({}); |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 return true; | 659 return true; |
| 660 } | 660 } |
| 661 | 661 |
| 662 List<TypeVariableMirror> _typeVariables = null; | 662 List<TypeVariableMirror> _typeVariables = null; |
| 663 List<TypeVariableMirror> get typeVariables { | 663 List<TypeVariableMirror> get typeVariables { |
| 664 if (_typeVariables == null) { | 664 if (_typeVariables == null) { |
| 665 if (_isAnonymousMixinApplication) return _typeVariables = emptyList; | 665 if (_isAnonymousMixinApplication) return _typeVariables = emptyList; |
| 666 _typeVariables = new List<TypeVariableMirror>(); | 666 _typeVariables = new List<TypeVariableMirror>(); |
| 667 | 667 |
| 668 List params = _ClassMirror_type_variables(_reflectee); | 668 List params = _ClassMirror_type_variables(_reflectee); |
| 669 ClassMirror owner = originalDeclaration; |
| 669 var mirror; | 670 var mirror; |
| 670 for (var i = 0; i < params.length; i += 2) { | 671 for (var i = 0; i < params.length; i += 2) { |
| 671 mirror = new _LocalTypeVariableMirrorImpl( | 672 mirror = new _LocalTypeVariableMirrorImpl( |
| 672 params[i + 1], params[i], this); | 673 params[i + 1], params[i], owner); |
| 673 _typeVariables.add(mirror); | 674 _typeVariables.add(mirror); |
| 674 } | 675 } |
| 675 _typeVariables = new UnmodifiableListView(_typeVariables); | 676 _typeVariables = new UnmodifiableListView(_typeVariables); |
| 676 } | 677 } |
| 677 return _typeVariables; | 678 return _typeVariables; |
| 678 } | 679 } |
| 679 | 680 |
| 680 List<TypeMirror> _typeArguments = null; | 681 List<TypeMirror> _typeArguments = null; |
| 681 List<TypeMirror> get typeArguments { | 682 List<TypeMirror> get typeArguments { |
| 682 if(_typeArguments == null) { | 683 if(_typeArguments == null) { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 class _LocalTypeVariableMirrorImpl extends _LocalDeclarationMirrorImpl | 900 class _LocalTypeVariableMirrorImpl extends _LocalDeclarationMirrorImpl |
| 900 implements TypeVariableMirror { | 901 implements TypeVariableMirror { |
| 901 _LocalTypeVariableMirrorImpl(reflectee, | 902 _LocalTypeVariableMirrorImpl(reflectee, |
| 902 String simpleName, | 903 String simpleName, |
| 903 this._owner) | 904 this._owner) |
| 904 : super(reflectee, _s(simpleName)); | 905 : super(reflectee, _s(simpleName)); |
| 905 | 906 |
| 906 DeclarationMirror _owner; | 907 DeclarationMirror _owner; |
| 907 DeclarationMirror get owner { | 908 DeclarationMirror get owner { |
| 908 if (_owner == null) { | 909 if (_owner == null) { |
| 909 _owner = _TypeVariableMirror_owner(_reflectee); | 910 _owner = _TypeVariableMirror_owner(_reflectee).originalDeclaration; |
| 910 } | 911 } |
| 911 return _owner; | 912 return _owner; |
| 912 } | 913 } |
| 913 | 914 |
| 914 bool get isPrivate => false; | 915 bool get isPrivate => false; |
| 915 | 916 |
| 916 final bool isTopLevel = false; | 917 final bool isTopLevel = false; |
| 917 | 918 |
| 918 SourceLocation get location { | 919 SourceLocation get location { |
| 919 throw new UnimplementedError( | 920 throw new UnimplementedError( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 } else { | 1017 } else { |
| 1017 return _nativeDeclaration(_reflectedType); | 1018 return _nativeDeclaration(_reflectedType); |
| 1018 } | 1019 } |
| 1019 } | 1020 } |
| 1020 | 1021 |
| 1021 List<TypeVariableMirror> _typeVariables = null; | 1022 List<TypeVariableMirror> _typeVariables = null; |
| 1022 List<TypeVariableMirror> get typeVariables { | 1023 List<TypeVariableMirror> get typeVariables { |
| 1023 if (_typeVariables == null) { | 1024 if (_typeVariables == null) { |
| 1024 _typeVariables = new List<TypeVariableMirror>(); | 1025 _typeVariables = new List<TypeVariableMirror>(); |
| 1025 List params = _LocalClassMirrorImpl._ClassMirror_type_variables(_reflectee
); | 1026 List params = _LocalClassMirrorImpl._ClassMirror_type_variables(_reflectee
); |
| 1027 TypedefMirror owner = originalDeclaration; |
| 1026 var mirror; | 1028 var mirror; |
| 1027 for (var i = 0; i < params.length; i += 2) { | 1029 for (var i = 0; i < params.length; i += 2) { |
| 1028 mirror = new _LocalTypeVariableMirrorImpl( | 1030 mirror = new _LocalTypeVariableMirrorImpl( |
| 1029 params[i + 1], params[i], this); | 1031 params[i + 1], params[i], owner); |
| 1030 _typeVariables.add(mirror); | 1032 _typeVariables.add(mirror); |
| 1031 } | 1033 } |
| 1032 } | 1034 } |
| 1033 return _typeVariables; | 1035 return _typeVariables; |
| 1034 } | 1036 } |
| 1035 | 1037 |
| 1036 List<TypeMirror> _typeArguments = null; | 1038 List<TypeMirror> _typeArguments = null; |
| 1037 List<TypeMirror> get typeArguments { | 1039 List<TypeMirror> get typeArguments { |
| 1038 if(_typeArguments == null) { | 1040 if(_typeArguments == null) { |
| 1039 if(_isGenericDeclaration) { | 1041 if(_isGenericDeclaration) { |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 if (typeMirror == null) { | 1505 if (typeMirror == null) { |
| 1504 typeMirror = makeLocalTypeMirror(key); | 1506 typeMirror = makeLocalTypeMirror(key); |
| 1505 _instanitationCache[key] = typeMirror; | 1507 _instanitationCache[key] = typeMirror; |
| 1506 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1508 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
| 1507 _declarationCache[key] = typeMirror; | 1509 _declarationCache[key] = typeMirror; |
| 1508 } | 1510 } |
| 1509 } | 1511 } |
| 1510 return typeMirror; | 1512 return typeMirror; |
| 1511 } | 1513 } |
| 1512 } | 1514 } |
| OLD | NEW |