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 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 ? ReferenceKind.method | 1209 ? ReferenceKind.method |
1210 : ReferenceKind.topLevelFunction; | 1210 : ReferenceKind.topLevelFunction; |
1211 break; | 1211 break; |
1212 case UnlinkedExecutableKind.setter: | 1212 case UnlinkedExecutableKind.setter: |
1213 kind = ReferenceKind.propertyAccessor; | 1213 kind = ReferenceKind.propertyAccessor; |
1214 break; | 1214 break; |
1215 default: | 1215 default: |
1216 // TODO(paulberry): implement other cases as necessary | 1216 // TODO(paulberry): implement other cases as necessary |
1217 throw new UnimplementedError('${element._unlinkedExecutable.kind}'); | 1217 throw new UnimplementedError('${element._unlinkedExecutable.kind}'); |
1218 } | 1218 } |
1219 return addRawReference(element.name, | 1219 if (enclosingClass == null) { |
1220 numTypeParameters: element.typeParameters.length, | 1220 return addRawReference(element.name, |
1221 containingReference: | 1221 numTypeParameters: element.typeParameters.length, |
1222 enclosingClass != null ? addReference(enclosingClass) : null, | 1222 dependency: |
1223 dependency: enclosingClass != null | 1223 library.addDependency(element.library as LibraryElementForLink), |
1224 ? null | 1224 unitNum: element.compilationUnit.unitNum, |
1225 : library.addDependency(element.library as LibraryElementForLink), | 1225 kind: kind); |
1226 kind: kind); | 1226 } else { |
| 1227 return addRawReference(element.name, |
| 1228 numTypeParameters: element.typeParameters.length, |
| 1229 containingReference: addReference(enclosingClass), |
| 1230 kind: kind); |
| 1231 } |
1227 } else if (element is FunctionElementForLink_Initializer) { | 1232 } else if (element is FunctionElementForLink_Initializer) { |
1228 return addRawReference('', | 1233 return addRawReference('', |
1229 containingReference: addReference(element.enclosingElement), | 1234 containingReference: addReference(element.enclosingElement), |
1230 kind: ReferenceKind.function); | 1235 kind: ReferenceKind.function); |
1231 } else if (element is TopLevelVariableElementForLink) { | 1236 } else if (element is TopLevelVariableElementForLink) { |
1232 return addRawReference(element.name, | 1237 return addRawReference(element.name, |
1233 dependency: library.addDependency(element.library), | 1238 dependency: library.addDependency(element.library), |
| 1239 unitNum: element.compilationUnit.unitNum, |
1234 kind: ReferenceKind.topLevelPropertyAccessor); | 1240 kind: ReferenceKind.topLevelPropertyAccessor); |
1235 } else if (element is FieldElementForLink_ClassField) { | 1241 } else if (element is FieldElementForLink_ClassField) { |
1236 ClassElementForLink_Class enclosingClass = element.enclosingElement; | 1242 ClassElementForLink_Class enclosingClass = element.enclosingElement; |
1237 // Note: even if the class has type parameters, we don't need to set | 1243 // Note: even if the class has type parameters, we don't need to set |
1238 // numTypeParameters because numTypeParameters does not count type | 1244 // numTypeParameters because numTypeParameters does not count type |
1239 // parameters of parent elements (see | 1245 // parameters of parent elements (see |
1240 // [LinkedReference.numTypeParameters]). | 1246 // [LinkedReference.numTypeParameters]). |
1241 return addRawReference(element.name, | 1247 return addRawReference(element.name, |
1242 containingReference: addReference(enclosingClass), | 1248 containingReference: addReference(enclosingClass), |
1243 kind: ReferenceKind.propertyAccessor); | 1249 kind: ReferenceKind.propertyAccessor); |
(...skipping 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5053 * there are no type parameters in scope. | 5059 * there are no type parameters in scope. |
5054 */ | 5060 */ |
5055 TypeParameterizedElementMixin get _typeParameterContext; | 5061 TypeParameterizedElementMixin get _typeParameterContext; |
5056 | 5062 |
5057 @override | 5063 @override |
5058 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 5064 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
5059 | 5065 |
5060 @override | 5066 @override |
5061 String toString() => '$enclosingElement.$name'; | 5067 String toString() => '$enclosingElement.$name'; |
5062 } | 5068 } |
OLD | NEW |