| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.element; | 8 library engine.element; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 3766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3777 } | 3777 } |
| 3778 if (object is! ElementLocationImpl) { | 3778 if (object is! ElementLocationImpl) { |
| 3779 return false; | 3779 return false; |
| 3780 } | 3780 } |
| 3781 ElementLocationImpl location = object as ElementLocationImpl; | 3781 ElementLocationImpl location = object as ElementLocationImpl; |
| 3782 List<String> otherComponents = location._components; | 3782 List<String> otherComponents = location._components; |
| 3783 int length = _components.length; | 3783 int length = _components.length; |
| 3784 if (otherComponents.length != length) { | 3784 if (otherComponents.length != length) { |
| 3785 return false; | 3785 return false; |
| 3786 } | 3786 } |
| 3787 for (int i = length - 1; i >= 2; i--) { | 3787 for (int i = 0; i < length; i++) { |
| 3788 if (_components[i] != otherComponents[i]) { | 3788 if (_components[i] != otherComponents[i]) { |
| 3789 return false; | 3789 return false; |
| 3790 } | 3790 } |
| 3791 } | 3791 } |
| 3792 if (length > 1 && !_equalSourceComponents(_components[1], otherComponents[1]
)) { | |
| 3793 return false; | |
| 3794 } | |
| 3795 if (length > 0 && !_equalSourceComponents(_components[0], otherComponents[0]
)) { | |
| 3796 return false; | |
| 3797 } | |
| 3798 return true; | 3792 return true; |
| 3799 } | 3793 } |
| 3800 | 3794 |
| 3801 @override | 3795 @override |
| 3802 List<String> get components => _components; | 3796 List<String> get components => _components; |
| 3803 | 3797 |
| 3804 @override | 3798 @override |
| 3805 String get encoding { | 3799 String get encoding { |
| 3806 JavaStringBuilder builder = new JavaStringBuilder(); | 3800 JavaStringBuilder builder = new JavaStringBuilder(); |
| 3807 int length = _components.length; | 3801 int length = _components.length; |
| 3808 for (int i = 0; i < length; i++) { | 3802 for (int i = 0; i < length; i++) { |
| 3809 if (i > 0) { | 3803 if (i > 0) { |
| 3810 builder.appendChar(_SEPARATOR_CHAR); | 3804 builder.appendChar(_SEPARATOR_CHAR); |
| 3811 } | 3805 } |
| 3812 _encode(builder, _components[i]); | 3806 _encode(builder, _components[i]); |
| 3813 } | 3807 } |
| 3814 return builder.toString(); | 3808 return builder.toString(); |
| 3815 } | 3809 } |
| 3816 | 3810 |
| 3817 @override | 3811 @override |
| 3818 int get hashCode { | 3812 int get hashCode { |
| 3819 int result = 1; | 3813 int result = 1; |
| 3820 for (int i = 0; i < _components.length; i++) { | 3814 for (int i = 0; i < _components.length; i++) { |
| 3821 String component = _components[i]; | 3815 String component = _components[i]; |
| 3822 int componentHash; | 3816 result = 31 * result + component.hashCode; |
| 3823 if (i <= 1) { | |
| 3824 componentHash = _hashSourceComponent(component); | |
| 3825 } else { | |
| 3826 componentHash = component.hashCode; | |
| 3827 } | |
| 3828 result = 31 * result + componentHash; | |
| 3829 } | 3817 } |
| 3830 return result; | 3818 return result; |
| 3831 } | 3819 } |
| 3832 | 3820 |
| 3833 @override | 3821 @override |
| 3834 String toString() => encoding; | 3822 String toString() => encoding; |
| 3835 | 3823 |
| 3836 /** | 3824 /** |
| 3837 * Decode the encoded form of a location into an array of components. | 3825 * Decode the encoded form of a location into an array of components. |
| 3838 * | 3826 * |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3873 void _encode(JavaStringBuilder builder, String component) { | 3861 void _encode(JavaStringBuilder builder, String component) { |
| 3874 int length = component.length; | 3862 int length = component.length; |
| 3875 for (int i = 0; i < length; i++) { | 3863 for (int i = 0; i < length; i++) { |
| 3876 int currentChar = component.codeUnitAt(i); | 3864 int currentChar = component.codeUnitAt(i); |
| 3877 if (currentChar == _SEPARATOR_CHAR) { | 3865 if (currentChar == _SEPARATOR_CHAR) { |
| 3878 builder.appendChar(_SEPARATOR_CHAR); | 3866 builder.appendChar(_SEPARATOR_CHAR); |
| 3879 } | 3867 } |
| 3880 builder.appendChar(currentChar); | 3868 builder.appendChar(currentChar); |
| 3881 } | 3869 } |
| 3882 } | 3870 } |
| 3883 | |
| 3884 /** | |
| 3885 * Return `true` if the given components, when interpreted to be encoded sourc
es with a | |
| 3886 * leading source type indicator, are equal when the source type's are ignored
. | |
| 3887 * | |
| 3888 * @param left the left component being compared | |
| 3889 * @param right the right component being compared | |
| 3890 * @return `true` if the given components are equal when the source type's are
ignored | |
| 3891 */ | |
| 3892 bool _equalSourceComponents(String left, String right) { | |
| 3893 // TODO(brianwilkerson) This method can go away when sources no longer have
a URI kind. | |
| 3894 if (left == null) { | |
| 3895 return right == null; | |
| 3896 } else if (right == null) { | |
| 3897 return false; | |
| 3898 } | |
| 3899 int leftLength = left.length; | |
| 3900 int rightLength = right.length; | |
| 3901 if (leftLength != rightLength) { | |
| 3902 return false; | |
| 3903 } else if (leftLength <= 1 || rightLength <= 1) { | |
| 3904 return left == right; | |
| 3905 } | |
| 3906 return javaStringRegionMatches(left, 1, right, 1, leftLength - 1); | |
| 3907 } | |
| 3908 | |
| 3909 /** | |
| 3910 * Return the hash code of the given encoded source component, ignoring the so
urce type indicator. | |
| 3911 * | |
| 3912 * @param sourceComponent the component to compute a hash code | |
| 3913 * @return the hash code of the given encoded source component | |
| 3914 */ | |
| 3915 int _hashSourceComponent(String sourceComponent) { | |
| 3916 // TODO(brianwilkerson) This method can go away when sources no longer have
a URI kind. | |
| 3917 if (sourceComponent.length <= 1) { | |
| 3918 return sourceComponent.hashCode; | |
| 3919 } | |
| 3920 return sourceComponent.substring(1).hashCode; | |
| 3921 } | |
| 3922 } | 3871 } |
| 3923 | 3872 |
| 3924 /** | 3873 /** |
| 3925 * The class `ElementPair` is a pair of [Element]s. [Object#equals] and | 3874 * The class `ElementPair` is a pair of [Element]s. [Object#equals] and |
| 3926 * [Object#hashCode] so this class can be used in hashed data structures. | 3875 * [Object#hashCode] so this class can be used in hashed data structures. |
| 3927 */ | 3876 */ |
| 3928 class ElementPair { | 3877 class ElementPair { |
| 3929 /** | 3878 /** |
| 3930 * The first [Element] | 3879 * The first [Element] |
| 3931 */ | 3880 */ |
| (...skipping 7047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10979 bool internalIsMoreSpecificThan(DartType s, bool withDynamic, Set<TypeImpl_Typ
ePair> visitedTypePairs) { | 10928 bool internalIsMoreSpecificThan(DartType s, bool withDynamic, Set<TypeImpl_Typ
ePair> visitedTypePairs) { |
| 10980 // | 10929 // |
| 10981 // A type T is more specific than a type S, written T << S, if one of the f
ollowing conditions | 10930 // A type T is more specific than a type S, written T << S, if one of the f
ollowing conditions |
| 10982 // is met: | 10931 // is met: |
| 10983 // | 10932 // |
| 10984 // Reflexivity: T is S. | 10933 // Reflexivity: T is S. |
| 10985 // | 10934 // |
| 10986 if (this == s) { | 10935 if (this == s) { |
| 10987 return true; | 10936 return true; |
| 10988 } | 10937 } |
| 10989 // S is bottom. | |
| 10990 // | |
| 10991 if (s.isBottom) { | |
| 10992 return true; | |
| 10993 } | |
| 10994 // S is dynamic. | 10938 // S is dynamic. |
| 10995 // | 10939 // |
| 10996 if (s.isDynamic) { | 10940 if (s.isDynamic) { |
| 10997 return true; | 10941 return true; |
| 10998 } | 10942 } |
| 10999 return _isMoreSpecificThan(s, new HashSet<DartType>(), withDynamic, visitedT
ypePairs); | 10943 return _isMoreSpecificThan(s, new HashSet<DartType>(), withDynamic, visitedT
ypePairs); |
| 11000 } | 10944 } |
| 11001 | 10945 |
| 11002 @override | 10946 @override |
| 11003 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair
s) => isMoreSpecificThan2(type, true, new HashSet<TypeImpl_TypePair>()); | 10947 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair
s) => isMoreSpecificThan2(type, true, new HashSet<TypeImpl_TypePair>()); |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11385 | 11329 |
| 11386 @override | 11330 @override |
| 11387 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) => id
entical(object, this); | 11331 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) => id
entical(object, this); |
| 11388 | 11332 |
| 11389 @override | 11333 @override |
| 11390 bool internalIsMoreSpecificThan(DartType type, bool withDynamic, Set<TypeImpl_
TypePair> visitedTypePairs) => isSubtypeOf(type); | 11334 bool internalIsMoreSpecificThan(DartType type, bool withDynamic, Set<TypeImpl_
TypePair> visitedTypePairs) => isSubtypeOf(type); |
| 11391 | 11335 |
| 11392 @override | 11336 @override |
| 11393 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair
s) => identical(type, this) || identical(type, DynamicTypeImpl.instance); | 11337 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair
s) => identical(type, this) || identical(type, DynamicTypeImpl.instance); |
| 11394 } | 11338 } |
| OLD | NEW |