| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /** | 5 /** |
| 6 * This library is capable of producing linked summaries from unlinked | 6 * This library is capable of producing linked summaries from unlinked |
| 7 * ones (or prelinked ones). It functions by building a miniature | 7 * ones (or prelinked ones). It functions by building a miniature |
| 8 * element model to represent the contents of the summaries, and then | 8 * element model to represent the contents of the summaries, and then |
| 9 * scanning the element model to gather linked information and adding | 9 * scanning the element model to gather linked information and adding |
| 10 * it to the summary data structures. | 10 * it to the summary data structures. |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 int addRawReference(String name, | 1072 int addRawReference(String name, |
| 1073 {int dependency: 0, | 1073 {int dependency: 0, |
| 1074 int numTypeParameters: 0, | 1074 int numTypeParameters: 0, |
| 1075 int unitNum: 0, | 1075 int unitNum: 0, |
| 1076 int containingReference: 0, | 1076 int containingReference: 0, |
| 1077 ReferenceKind kind: ReferenceKind.classOrEnum}) { | 1077 ReferenceKind kind: ReferenceKind.classOrEnum}) { |
| 1078 List<LinkedReferenceBuilder> linkedReferences = _linkedUnit.references; | 1078 List<LinkedReferenceBuilder> linkedReferences = _linkedUnit.references; |
| 1079 List<UnlinkedReference> unlinkedReferences = _unlinkedUnit.references; | 1079 List<UnlinkedReference> unlinkedReferences = _unlinkedUnit.references; |
| 1080 for (int i = 0; i < linkedReferences.length; i++) { | 1080 for (int i = 0; i < linkedReferences.length; i++) { |
| 1081 LinkedReferenceBuilder linkedReference = linkedReferences[i]; | 1081 LinkedReferenceBuilder linkedReference = linkedReferences[i]; |
| 1082 int candidateContainingReference = i < unlinkedReferences.length |
| 1083 ? unlinkedReferences[i].prefixReference |
| 1084 : linkedReference.containingReference; |
| 1085 if (candidateContainingReference != 0 && |
| 1086 linkedReferences[candidateContainingReference].kind == |
| 1087 ReferenceKind.prefix) { |
| 1088 // We don't need to match containing references when they are prefixes, |
| 1089 // since the relevant information is in linkedReference.dependency. |
| 1090 candidateContainingReference = 0; |
| 1091 } |
| 1082 if (linkedReference.dependency == dependency && | 1092 if (linkedReference.dependency == dependency && |
| 1083 (i < unlinkedReferences.length | 1093 (i < unlinkedReferences.length |
| 1084 ? unlinkedReferences[i].name | 1094 ? unlinkedReferences[i].name |
| 1085 : linkedReference.name) == | 1095 : linkedReference.name) == |
| 1086 name && | 1096 name && |
| 1087 linkedReference.numTypeParameters == numTypeParameters && | 1097 linkedReference.numTypeParameters == numTypeParameters && |
| 1088 linkedReference.unit == unitNum && | 1098 linkedReference.unit == unitNum && |
| 1089 (i < unlinkedReferences.length | 1099 candidateContainingReference == containingReference && |
| 1090 ? unlinkedReferences[i].prefixReference | |
| 1091 : linkedReference.containingReference) == | |
| 1092 containingReference && | |
| 1093 linkedReference.kind == kind) { | 1100 linkedReference.kind == kind) { |
| 1094 return i; | 1101 return i; |
| 1095 } | 1102 } |
| 1096 } | 1103 } |
| 1097 int result = linkedReferences.length; | 1104 int result = linkedReferences.length; |
| 1098 linkedReferences.add(new LinkedReferenceBuilder( | 1105 linkedReferences.add(new LinkedReferenceBuilder( |
| 1099 dependency: dependency, | 1106 dependency: dependency, |
| 1100 name: name, | 1107 name: name, |
| 1101 numTypeParameters: numTypeParameters, | 1108 numTypeParameters: numTypeParameters, |
| 1102 unit: unitNum, | 1109 unit: unitNum, |
| (...skipping 3627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4730 * there are no type parameters in scope. | 4737 * there are no type parameters in scope. |
| 4731 */ | 4738 */ |
| 4732 TypeParameterizedElementForLink get _typeParameterContext; | 4739 TypeParameterizedElementForLink get _typeParameterContext; |
| 4733 | 4740 |
| 4734 @override | 4741 @override |
| 4735 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 4742 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 4736 | 4743 |
| 4737 @override | 4744 @override |
| 4738 String toString() => '$enclosingElement.$name'; | 4745 String toString() => '$enclosingElement.$name'; |
| 4739 } | 4746 } |
| OLD | NEW |