Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.test.src.task.dart_test; | 5 library analyzer.test.src.task.dart_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 import 'package:analyzer/task/dart.dart'; | 26 import 'package:analyzer/task/dart.dart'; |
| 27 import 'package:analyzer/task/general.dart'; | 27 import 'package:analyzer/task/general.dart'; |
| 28 import 'package:analyzer/task/model.dart'; | 28 import 'package:analyzer/task/model.dart'; |
| 29 import 'package:test/test.dart'; | 29 import 'package:test/test.dart'; |
| 30 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 30 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 31 | 31 |
| 32 import '../../generated/resolver_test_case.dart'; | 32 import '../../generated/resolver_test_case.dart'; |
| 33 import '../../generated/test_support.dart'; | 33 import '../../generated/test_support.dart'; |
| 34 import '../../utils.dart'; | 34 import '../../utils.dart'; |
| 35 import '../context/abstract_context.dart'; | 35 import '../context/abstract_context.dart'; |
| 36 import 'package:analyzer/dart/ast/resolution_accessors.dart'; | |
|
scheglov
2016/12/05 17:10:50
Not sorted.
Paul Berry
2016/12/05 17:50:48
Fixed, thanks.
| |
| 36 | 37 |
| 37 main() { | 38 main() { |
| 38 defineReflectiveSuite(() { | 39 defineReflectiveSuite(() { |
| 39 defineReflectiveTests(BuildCompilationUnitElementTaskTest); | 40 defineReflectiveTests(BuildCompilationUnitElementTaskTest); |
| 40 defineReflectiveTests(BuildDirectiveElementsTaskTest); | 41 defineReflectiveTests(BuildDirectiveElementsTaskTest); |
| 41 defineReflectiveTests(BuildEnumMemberElementsTaskTest); | 42 defineReflectiveTests(BuildEnumMemberElementsTaskTest); |
| 42 defineReflectiveTests(BuildExportNamespaceTaskTest); | 43 defineReflectiveTests(BuildExportNamespaceTaskTest); |
| 43 defineReflectiveTests(BuildLibraryElementTaskTest); | 44 defineReflectiveTests(BuildLibraryElementTaskTest); |
| 44 defineReflectiveTests(BuildPublicNamespaceTaskTest); | 45 defineReflectiveTests(BuildPublicNamespaceTaskTest); |
| 45 defineReflectiveTests(BuildSourceExportClosureTaskTest); | 46 defineReflectiveTests(BuildSourceExportClosureTaskTest); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 CompilationUnitElement unitElement = outputs[COMPILATION_UNIT_ELEMENT]; | 180 CompilationUnitElement unitElement = outputs[COMPILATION_UNIT_ELEMENT]; |
| 180 Annotation annotation = unit.declarations | 181 Annotation annotation = unit.declarations |
| 181 .firstWhere((m) => m is FunctionDeclaration) | 182 .firstWhere((m) => m is FunctionDeclaration) |
| 182 .metadata[0]; | 183 .metadata[0]; |
| 183 List<ConstantEvaluationTarget> expectedConstants = | 184 List<ConstantEvaluationTarget> expectedConstants = |
| 184 <ConstantEvaluationTarget>[ | 185 <ConstantEvaluationTarget>[ |
| 185 unitElement.accessors.firstWhere((e) => e.isGetter).variable, | 186 unitElement.accessors.firstWhere((e) => e.isGetter).variable, |
| 186 unitElement.types[0].fields[0], | 187 unitElement.types[0].fields[0], |
| 187 unitElement.functions[0].localVariables[0], | 188 unitElement.functions[0].localVariables[0], |
| 188 unitElement.types[0].constructors[0], | 189 unitElement.types[0].constructors[0], |
| 189 annotation.elementAnnotation, | 190 elementAnnotationForAnnotation(annotation), |
| 190 unitElement.types[0].constructors[0].parameters[0] | 191 unitElement.types[0].constructors[0].parameters[0] |
| 191 ]; | 192 ]; |
| 192 expect( | 193 expect( |
| 193 outputs[COMPILATION_UNIT_CONSTANTS].toSet(), expectedConstants.toSet()); | 194 outputs[COMPILATION_UNIT_CONSTANTS].toSet(), expectedConstants.toSet()); |
| 194 } | 195 } |
| 195 | 196 |
| 196 test_perform_library() { | 197 test_perform_library() { |
| 197 _performBuildTask(r''' | 198 _performBuildTask(r''' |
| 198 library lib; | 199 library lib; |
| 199 import 'lib2.dart'; | 200 import 'lib2.dart'; |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 matcher: isBuildDirectiveElementsTask); | 574 matcher: isBuildDirectiveElementsTask); |
| 574 // Get outputs | 575 // Get outputs |
| 575 LibraryElement libraryA = | 576 LibraryElement libraryA = |
| 576 context.getCacheEntry(sourceA).getValue(LIBRARY_ELEMENT2); | 577 context.getCacheEntry(sourceA).getValue(LIBRARY_ELEMENT2); |
| 577 CompilationUnit part = context | 578 CompilationUnit part = context |
| 578 .getCacheEntry(new LibrarySpecificUnit(sourceA, sourcePart)) | 579 .getCacheEntry(new LibrarySpecificUnit(sourceA, sourcePart)) |
| 579 .getValue(RESOLVED_UNIT1); | 580 .getValue(RESOLVED_UNIT1); |
| 580 // Validate metadata | 581 // Validate metadata |
| 581 expect(part.directives[0], new isInstanceOf<PartOfDirective>()); | 582 expect(part.directives[0], new isInstanceOf<PartOfDirective>()); |
| 582 expect(part.directives[0].element, same(libraryA)); | 583 expect(part.directives[0].element, same(libraryA)); |
| 583 expect(part.directives[0].element.metadata, isEmpty); | 584 expect(elementForDirective(part.directives[0]).metadata, isEmpty); |
| 584 } | 585 } |
| 585 | 586 |
| 586 void _assertErrorsWithCodes(List<ErrorCode> expectedErrorCodes) { | 587 void _assertErrorsWithCodes(List<ErrorCode> expectedErrorCodes) { |
| 587 _fillErrorListener(BUILD_DIRECTIVES_ERRORS); | 588 _fillErrorListener(BUILD_DIRECTIVES_ERRORS); |
| 588 errorListener.assertErrorsWithCodes(expectedErrorCodes); | 589 errorListener.assertErrorsWithCodes(expectedErrorCodes); |
| 589 } | 590 } |
| 590 | 591 |
| 591 _getExportLibraryInput(Source source) { | 592 _getExportLibraryInput(Source source) { |
| 592 var key = BuildDirectiveElementsTask.EXPORTS_LIBRARY_ELEMENT_INPUT_NAME; | 593 var key = BuildDirectiveElementsTask.EXPORTS_LIBRARY_ELEMENT_INPUT_NAME; |
| 593 return task.inputs[key][source]; | 594 return task.inputs[key][source]; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 619 '/test.dart', | 620 '/test.dart', |
| 620 ''' | 621 ''' |
| 621 enum MyEnum { | 622 enum MyEnum { |
| 622 A, B | 623 A, B |
| 623 } | 624 } |
| 624 '''); | 625 '''); |
| 625 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT3, | 626 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT3, |
| 626 matcher: isBuildEnumMemberElementsTask); | 627 matcher: isBuildEnumMemberElementsTask); |
| 627 CompilationUnit unit = outputs[RESOLVED_UNIT3]; | 628 CompilationUnit unit = outputs[RESOLVED_UNIT3]; |
| 628 // validate Element | 629 // validate Element |
| 629 ClassElement enumElement = unit.element.getEnum('MyEnum'); | 630 ClassElement enumElement = |
| 631 elementForCompilationUnit(unit).getEnum('MyEnum'); | |
| 630 List<FieldElement> fields = enumElement.fields; | 632 List<FieldElement> fields = enumElement.fields; |
| 631 expect(fields, hasLength(4)); | 633 expect(fields, hasLength(4)); |
| 632 { | 634 { |
| 633 FieldElementImpl index = fields[0]; | 635 FieldElementImpl index = fields[0]; |
| 634 expect(index, isNotNull); | 636 expect(index, isNotNull); |
| 635 expect(index.name, 'index'); | 637 expect(index.name, 'index'); |
| 636 expect(index.isStatic, isFalse); | 638 expect(index.isStatic, isFalse); |
| 637 expect(index.evaluationResult, isNull); | 639 expect(index.evaluationResult, isNull); |
| 638 _assertGetter(index); | 640 _assertGetter(index); |
| 639 } | 641 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 825 // LibraryElement references | 827 // LibraryElement references |
| 826 expect((libraryUnit.directives[0] as LibraryDirective).element, | 828 expect((libraryUnit.directives[0] as LibraryDirective).element, |
| 827 same(libraryElement)); | 829 same(libraryElement)); |
| 828 expect((partUnits[0].directives[0] as PartOfDirective).element, | 830 expect((partUnits[0].directives[0] as PartOfDirective).element, |
| 829 same(libraryElement)); | 831 same(libraryElement)); |
| 830 expect((partUnits[1].directives[0] as PartOfDirective).element, | 832 expect((partUnits[1].directives[0] as PartOfDirective).element, |
| 831 same(libraryElement)); | 833 same(libraryElement)); |
| 832 // CompilationUnitElement(s) | 834 // CompilationUnitElement(s) |
| 833 CompilationUnitElement firstPart; | 835 CompilationUnitElement firstPart; |
| 834 CompilationUnitElement secondPart; | 836 CompilationUnitElement secondPart; |
| 835 if (partUnits[0].element.uri == 'part1.dart') { | 837 if (elementForCompilationUnit(partUnits[0]).uri == 'part1.dart') { |
| 836 firstPart = partUnits[0].element; | 838 firstPart = partUnits[0].element; |
| 837 secondPart = partUnits[1].element; | 839 secondPart = partUnits[1].element; |
| 838 } else { | 840 } else { |
| 839 firstPart = partUnits[1].element; | 841 firstPart = partUnits[1].element; |
| 840 secondPart = partUnits[0].element; | 842 secondPart = partUnits[0].element; |
| 841 } | 843 } |
| 842 expect(firstPart.uri, 'part1.dart'); | 844 expect(firstPart.uri, 'part1.dart'); |
| 843 expect(firstPart.uriOffset, 18); | 845 expect(firstPart.uriOffset, 18); |
| 844 expect(firstPart.uriEnd, 30); | 846 expect(firstPart.uriEnd, 30); |
| 845 expect( | 847 expect( |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 993 '/part1.dart': ''' | 995 '/part1.dart': ''' |
| 994 part of lib; | 996 part of lib; |
| 995 int get test => 0; | 997 int get test => 0; |
| 996 ''', | 998 ''', |
| 997 '/part2.dart': ''' | 999 '/part2.dart': ''' |
| 998 part of lib; | 1000 part of lib; |
| 999 void set test(_) {} | 1001 void set test(_) {} |
| 1000 ''' | 1002 ''' |
| 1001 }); | 1003 }); |
| 1002 CompilationUnitElement unitElement1 = partUnits | 1004 CompilationUnitElement unitElement1 = partUnits |
| 1003 .singleWhere((u) => u.element.name.endsWith('part1.dart')) | 1005 .singleWhere( |
| 1006 (u) => elementForCompilationUnit(u).name.endsWith('part1.dart')) | |
| 1004 .element; | 1007 .element; |
| 1005 CompilationUnitElement unitElement2 = partUnits | 1008 CompilationUnitElement unitElement2 = partUnits |
| 1006 .singleWhere((u) => u.element.name.endsWith('part2.dart')) | 1009 .singleWhere( |
| 1010 (u) => elementForCompilationUnit(u).name.endsWith('part2.dart')) | |
| 1007 .element; | 1011 .element; |
| 1008 PropertyAccessorElement getter = unitElement1.accessors[0]; | 1012 PropertyAccessorElement getter = unitElement1.accessors[0]; |
| 1009 PropertyAccessorElement setter = unitElement2.accessors[0]; | 1013 PropertyAccessorElement setter = unitElement2.accessors[0]; |
| 1010 PropertyInducingElement variable = getter.variable; | 1014 PropertyInducingElement variable = getter.variable; |
| 1011 expect(getter.isGetter, isTrue); | 1015 expect(getter.isGetter, isTrue); |
| 1012 expect(setter.isSetter, isTrue); | 1016 expect(setter.isSetter, isTrue); |
| 1013 expect(variable, isNotNull); | 1017 expect(variable, isNotNull); |
| 1014 expect(setter.variable, same(variable)); | 1018 expect(setter.variable, same(variable)); |
| 1015 expect(unitElement1.topLevelVariables, [variable]); | 1019 expect(unitElement1.topLevelVariables, [variable]); |
| 1016 expect(unitElement2.topLevelVariables, [variable]); | 1020 expect(unitElement2.topLevelVariables, [variable]); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1150 const x = 1; | 1154 const x = 1; |
| 1151 @D(x) class C {} | 1155 @D(x) class C {} |
| 1152 class D { const D(value); } | 1156 class D { const D(value); } |
| 1153 '''); | 1157 '''); |
| 1154 // First compute the resolved unit for the source. | 1158 // First compute the resolved unit for the source. |
| 1155 LibrarySpecificUnit librarySpecificUnit = | 1159 LibrarySpecificUnit librarySpecificUnit = |
| 1156 new LibrarySpecificUnit(source, source); | 1160 new LibrarySpecificUnit(source, source); |
| 1157 computeResult(librarySpecificUnit, RESOLVED_UNIT1); | 1161 computeResult(librarySpecificUnit, RESOLVED_UNIT1); |
| 1158 CompilationUnit unit = outputs[RESOLVED_UNIT1]; | 1162 CompilationUnit unit = outputs[RESOLVED_UNIT1]; |
| 1159 // Find the elements for x and D's constructor, and the annotation on C. | 1163 // Find the elements for x and D's constructor, and the annotation on C. |
| 1160 List<PropertyAccessorElement> accessors = unit.element.accessors; | 1164 CompilationUnitElement compilationUnitElement = |
| 1165 elementForCompilationUnit(unit); | |
| 1166 List<PropertyAccessorElement> accessors = compilationUnitElement.accessors; | |
| 1161 Element x = accessors | 1167 Element x = accessors |
| 1162 .firstWhere((PropertyAccessorElement accessor) => | 1168 .firstWhere((PropertyAccessorElement accessor) => |
| 1163 accessor.isGetter && accessor.name == 'x') | 1169 accessor.isGetter && accessor.name == 'x') |
| 1164 .variable; | 1170 .variable; |
| 1165 List<ClassElement> types = unit.element.types; | 1171 List<ClassElement> types = compilationUnitElement.types; |
| 1166 Element constructorForD = | 1172 Element constructorForD = |
| 1167 types.firstWhere((ClassElement cls) => cls.name == 'D').constructors[0]; | 1173 types.firstWhere((ClassElement cls) => cls.name == 'D').constructors[0]; |
| 1168 Annotation annotation = findClassAnnotation(unit, 'C'); | 1174 Annotation annotation = findClassAnnotation(unit, 'C'); |
| 1169 // Now compute the dependencies for the annotation, and check that it is | 1175 // Now compute the dependencies for the annotation, and check that it is |
| 1170 // the set [x, constructorForD]. | 1176 // the set [x, constructorForD]. |
| 1171 // TODO(paulberry): test librarySource != source | 1177 // TODO(paulberry): test librarySource != source |
| 1172 computeResult(annotation.elementAnnotation, CONSTANT_DEPENDENCIES, | 1178 computeResult( |
| 1179 elementAnnotationForAnnotation(annotation), CONSTANT_DEPENDENCIES, | |
| 1173 matcher: isComputeConstantDependenciesTask); | 1180 matcher: isComputeConstantDependenciesTask); |
| 1174 expect( | 1181 expect( |
| 1175 outputs[CONSTANT_DEPENDENCIES].toSet(), [x, constructorForD].toSet()); | 1182 outputs[CONSTANT_DEPENDENCIES].toSet(), [x, constructorForD].toSet()); |
| 1176 } | 1183 } |
| 1177 | 1184 |
| 1178 test_annotation_with_nonConstArg() { | 1185 test_annotation_with_nonConstArg() { |
| 1179 Source source = newSource( | 1186 Source source = newSource( |
| 1180 '/test.dart', | 1187 '/test.dart', |
| 1181 ''' | 1188 ''' |
| 1182 class A { | 1189 class A { |
| 1183 const A(x); | 1190 const A(x); |
| 1184 } | 1191 } |
| 1185 class C { | 1192 class C { |
| 1186 @A(const [(_) => null]) | 1193 @A(const [(_) => null]) |
| 1187 String s; | 1194 String s; |
| 1188 } | 1195 } |
| 1189 '''); | 1196 '''); |
| 1190 // First compute the resolved unit for the source. | 1197 // First compute the resolved unit for the source. |
| 1191 LibrarySpecificUnit librarySpecificUnit = | 1198 LibrarySpecificUnit librarySpecificUnit = |
| 1192 new LibrarySpecificUnit(source, source); | 1199 new LibrarySpecificUnit(source, source); |
| 1193 computeResult(librarySpecificUnit, RESOLVED_UNIT1); | 1200 computeResult(librarySpecificUnit, RESOLVED_UNIT1); |
| 1194 CompilationUnit unit = outputs[RESOLVED_UNIT1]; | 1201 CompilationUnit unit = outputs[RESOLVED_UNIT1]; |
| 1195 // Find the annotation on the field. | 1202 // Find the annotation on the field. |
| 1196 ClassDeclaration classC = unit.declarations[1]; | 1203 ClassDeclaration classC = unit.declarations[1]; |
| 1197 Annotation annotation = classC.members[0].metadata[0]; | 1204 Annotation annotation = classC.members[0].metadata[0]; |
| 1198 // Now compute the dependencies for the annotation, and check that it is | 1205 // Now compute the dependencies for the annotation, and check that it is |
| 1199 // the right size. | 1206 // the right size. |
| 1200 computeResult(annotation.elementAnnotation, CONSTANT_DEPENDENCIES, | 1207 computeResult( |
| 1208 elementAnnotationForAnnotation(annotation), CONSTANT_DEPENDENCIES, | |
| 1201 matcher: isComputeConstantDependenciesTask); | 1209 matcher: isComputeConstantDependenciesTask); |
| 1202 expect(outputs[CONSTANT_DEPENDENCIES], hasLength(1)); | 1210 expect(outputs[CONSTANT_DEPENDENCIES], hasLength(1)); |
| 1203 } | 1211 } |
| 1204 | 1212 |
| 1205 test_annotation_without_args() { | 1213 test_annotation_without_args() { |
| 1206 Source source = newSource( | 1214 Source source = newSource( |
| 1207 '/test.dart', | 1215 '/test.dart', |
| 1208 ''' | 1216 ''' |
| 1209 const x = 1; | 1217 const x = 1; |
| 1210 @x class C {} | 1218 @x class C {} |
| 1211 '''); | 1219 '''); |
| 1212 // First compute the resolved unit for the source. | 1220 // First compute the resolved unit for the source. |
| 1213 LibrarySpecificUnit librarySpecificUnit = | 1221 LibrarySpecificUnit librarySpecificUnit = |
| 1214 new LibrarySpecificUnit(source, source); | 1222 new LibrarySpecificUnit(source, source); |
| 1215 computeResult(librarySpecificUnit, RESOLVED_UNIT1); | 1223 computeResult(librarySpecificUnit, RESOLVED_UNIT1); |
| 1216 CompilationUnit unit = outputs[RESOLVED_UNIT1]; | 1224 CompilationUnit unit = outputs[RESOLVED_UNIT1]; |
| 1217 // Find the element for x and the annotation on C. | 1225 // Find the element for x and the annotation on C. |
| 1218 List<PropertyAccessorElement> accessors = unit.element.accessors; | 1226 List<PropertyAccessorElement> accessors = |
| 1227 elementForCompilationUnit(unit).accessors; | |
| 1219 Element x = accessors | 1228 Element x = accessors |
| 1220 .firstWhere((PropertyAccessorElement accessor) => | 1229 .firstWhere((PropertyAccessorElement accessor) => |
| 1221 accessor.isGetter && accessor.name == 'x') | 1230 accessor.isGetter && accessor.name == 'x') |
| 1222 .variable; | 1231 .variable; |
| 1223 Annotation annotation = findClassAnnotation(unit, 'C'); | 1232 Annotation annotation = findClassAnnotation(unit, 'C'); |
| 1224 // Now compute the dependencies for the annotation, and check that it is | 1233 // Now compute the dependencies for the annotation, and check that it is |
| 1225 // the list [x]. | 1234 // the list [x]. |
| 1226 computeResult(annotation.elementAnnotation, CONSTANT_DEPENDENCIES, | 1235 computeResult( |
| 1236 elementAnnotationForAnnotation(annotation), CONSTANT_DEPENDENCIES, | |
| 1227 matcher: isComputeConstantDependenciesTask); | 1237 matcher: isComputeConstantDependenciesTask); |
| 1228 expect(outputs[CONSTANT_DEPENDENCIES], [x]); | 1238 expect(outputs[CONSTANT_DEPENDENCIES], [x]); |
| 1229 } | 1239 } |
| 1230 | 1240 |
| 1231 test_enumConstant() { | 1241 test_enumConstant() { |
| 1232 Source source = newSource( | 1242 Source source = newSource( |
| 1233 '/test.dart', | 1243 '/test.dart', |
| 1234 ''' | 1244 ''' |
| 1235 enum E {A, B, C} | 1245 enum E {A, B, C} |
| 1236 '''); | 1246 '''); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1256 ''' | 1266 ''' |
| 1257 const x = y; | 1267 const x = y; |
| 1258 const y = 1; | 1268 const y = 1; |
| 1259 '''); | 1269 '''); |
| 1260 // First compute the resolved unit for the source. | 1270 // First compute the resolved unit for the source. |
| 1261 LibrarySpecificUnit librarySpecificUnit = | 1271 LibrarySpecificUnit librarySpecificUnit = |
| 1262 new LibrarySpecificUnit(source, source); | 1272 new LibrarySpecificUnit(source, source); |
| 1263 computeResult(librarySpecificUnit, RESOLVED_UNIT1); | 1273 computeResult(librarySpecificUnit, RESOLVED_UNIT1); |
| 1264 CompilationUnit unit = outputs[RESOLVED_UNIT1]; | 1274 CompilationUnit unit = outputs[RESOLVED_UNIT1]; |
| 1265 // Find the elements for the constants x and y. | 1275 // Find the elements for the constants x and y. |
| 1266 List<PropertyAccessorElement> accessors = unit.element.accessors; | 1276 List<PropertyAccessorElement> accessors = |
| 1277 elementForCompilationUnit(unit).accessors; | |
| 1267 Element x = accessors | 1278 Element x = accessors |
| 1268 .firstWhere((PropertyAccessorElement accessor) => | 1279 .firstWhere((PropertyAccessorElement accessor) => |
| 1269 accessor.isGetter && accessor.name == 'x') | 1280 accessor.isGetter && accessor.name == 'x') |
| 1270 .variable; | 1281 .variable; |
| 1271 Element y = accessors | 1282 Element y = accessors |
| 1272 .firstWhere((PropertyAccessorElement accessor) => | 1283 .firstWhere((PropertyAccessorElement accessor) => |
| 1273 accessor.isGetter && accessor.name == 'y') | 1284 accessor.isGetter && accessor.name == 'y') |
| 1274 .variable; | 1285 .variable; |
| 1275 // Now compute the dependencies for x, and check that it is the list [y]. | 1286 // Now compute the dependencies for x, and check that it is the list [y]. |
| 1276 computeResult(x, CONSTANT_DEPENDENCIES, | 1287 computeResult(x, CONSTANT_DEPENDENCIES, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1532 test_perform() { | 1543 test_perform() { |
| 1533 AnalysisTarget source = newSource( | 1544 AnalysisTarget source = newSource( |
| 1534 '/test.dart', | 1545 '/test.dart', |
| 1535 ''' | 1546 ''' |
| 1536 const a = b; | 1547 const a = b; |
| 1537 const b = 0; | 1548 const b = 0; |
| 1538 '''); | 1549 '''); |
| 1539 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); | 1550 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); |
| 1540 computeResult(target, RESOLVED_UNIT7); | 1551 computeResult(target, RESOLVED_UNIT7); |
| 1541 CompilationUnit unit = outputs[RESOLVED_UNIT7]; | 1552 CompilationUnit unit = outputs[RESOLVED_UNIT7]; |
| 1542 TopLevelVariableElement elementA = unit.element.topLevelVariables[0]; | 1553 TopLevelVariableElement elementA = |
| 1543 TopLevelVariableElement elementB = unit.element.topLevelVariables[1]; | 1554 elementForCompilationUnit(unit).topLevelVariables[0]; |
| 1555 TopLevelVariableElement elementB = | |
| 1556 elementForCompilationUnit(unit).topLevelVariables[1]; | |
| 1544 | 1557 |
| 1545 computeResult(elementA, INFERABLE_STATIC_VARIABLE_DEPENDENCIES, | 1558 computeResult(elementA, INFERABLE_STATIC_VARIABLE_DEPENDENCIES, |
| 1546 matcher: isComputeInferableStaticVariableDependenciesTask); | 1559 matcher: isComputeInferableStaticVariableDependenciesTask); |
| 1547 expect(outputs, hasLength(1)); | 1560 expect(outputs, hasLength(1)); |
| 1548 List<VariableElement> dependencies = outputs[ | 1561 List<VariableElement> dependencies = outputs[ |
| 1549 INFERABLE_STATIC_VARIABLE_DEPENDENCIES] as List<VariableElement>; | 1562 INFERABLE_STATIC_VARIABLE_DEPENDENCIES] as List<VariableElement>; |
| 1550 expect(dependencies, unorderedEquals([elementB])); | 1563 expect(dependencies, unorderedEquals([elementB])); |
| 1551 } | 1564 } |
| 1552 } | 1565 } |
| 1553 | 1566 |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2671 } | 2684 } |
| 2672 class X {} | 2685 class X {} |
| 2673 class Y {} | 2686 class Y {} |
| 2674 class Z {} | 2687 class Z {} |
| 2675 '''); | 2688 '''); |
| 2676 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT10, | 2689 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT10, |
| 2677 matcher: isInferInstanceMembersInUnitTask); | 2690 matcher: isInferInstanceMembersInUnitTask); |
| 2678 CompilationUnit unit = outputs[RESOLVED_UNIT10]; | 2691 CompilationUnit unit = outputs[RESOLVED_UNIT10]; |
| 2679 VariableDeclaration field = AstFinder.getFieldInClass(unit, 'B', 'f'); | 2692 VariableDeclaration field = AstFinder.getFieldInClass(unit, 'B', 'f'); |
| 2680 MethodDeclaration method = AstFinder.getMethodInClass(unit, 'B', 'm'); | 2693 MethodDeclaration method = AstFinder.getMethodInClass(unit, 'B', 'm'); |
| 2681 DartType typeX = AstFinder.getClass(unit, 'X').element.type; | 2694 DartType typeX = |
| 2682 DartType typeY = AstFinder.getClass(unit, 'Y').element.type; | 2695 elementForClassDeclaration(AstFinder.getClass(unit, 'X')).type; |
| 2683 DartType typeZ = AstFinder.getClass(unit, 'Z').element.type; | 2696 DartType typeY = |
| 2697 elementForClassDeclaration(AstFinder.getClass(unit, 'Y')).type; | |
| 2698 DartType typeZ = | |
| 2699 elementForClassDeclaration(AstFinder.getClass(unit, 'Z')).type; | |
| 2684 | 2700 |
| 2685 expect(field.element.type, typeX); | 2701 expect(elementForVariableDeclaration(field).type, typeX); |
| 2686 expect(method.element.returnType, typeY); | 2702 expect(elementForMethodDeclaration(method).returnType, typeY); |
| 2687 expect(method.element.parameters[0].type, typeZ); | 2703 expect(elementForMethodDeclaration(method).parameters[0].type, typeZ); |
| 2688 } | 2704 } |
| 2689 | 2705 |
| 2690 void test_perform_cross_library_const() { | 2706 void test_perform_cross_library_const() { |
| 2691 enableStrongMode(); | 2707 enableStrongMode(); |
| 2692 AnalysisTarget firstSource = newSource( | 2708 AnalysisTarget firstSource = newSource( |
| 2693 '/first.dart', | 2709 '/first.dart', |
| 2694 ''' | 2710 ''' |
| 2695 library first; | 2711 library first; |
| 2696 | 2712 |
| 2697 const a = 'hello'; | 2713 const a = 'hello'; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 2715 CompilationUnit secondUnit = outputs[RESOLVED_UNIT10]; | 2731 CompilationUnit secondUnit = outputs[RESOLVED_UNIT10]; |
| 2716 | 2732 |
| 2717 VariableDeclaration variableA = | 2733 VariableDeclaration variableA = |
| 2718 AstFinder.getTopLevelVariable(firstUnit, 'a'); | 2734 AstFinder.getTopLevelVariable(firstUnit, 'a'); |
| 2719 VariableDeclaration variableB = | 2735 VariableDeclaration variableB = |
| 2720 AstFinder.getTopLevelVariable(secondUnit, 'b'); | 2736 AstFinder.getTopLevelVariable(secondUnit, 'b'); |
| 2721 VariableDeclaration variableC = | 2737 VariableDeclaration variableC = |
| 2722 AstFinder.getFieldInClass(secondUnit, 'M', 'c'); | 2738 AstFinder.getFieldInClass(secondUnit, 'M', 'c'); |
| 2723 InterfaceType stringType = context.typeProvider.stringType; | 2739 InterfaceType stringType = context.typeProvider.stringType; |
| 2724 | 2740 |
| 2725 expect(variableA.element.type, stringType); | 2741 expect(elementForVariableDeclaration(variableA).type, stringType); |
| 2726 expect(variableB.element.type, stringType); | 2742 expect(elementForVariableDeclaration(variableB).type, stringType); |
| 2727 expect(variableB.initializer.staticType, stringType); | 2743 expect(variableB.initializer.staticType, stringType); |
| 2728 expect(variableC.element.type, stringType); | 2744 expect(elementForVariableDeclaration(variableC).type, stringType); |
| 2729 expect(variableC.initializer.staticType, stringType); | 2745 expect(variableC.initializer.staticType, stringType); |
| 2730 } | 2746 } |
| 2731 | 2747 |
| 2732 void test_perform_reresolution() { | 2748 void test_perform_reresolution() { |
| 2733 enableStrongMode(); | 2749 enableStrongMode(); |
| 2734 AnalysisTarget source = newSource( | 2750 AnalysisTarget source = newSource( |
| 2735 '/test.dart', | 2751 '/test.dart', |
| 2736 ''' | 2752 ''' |
| 2737 const topLevel = ''; | 2753 const topLevel = ''; |
| 2738 class C { | 2754 class C { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2783 ''' | 2799 ''' |
| 2784 class M { | 2800 class M { |
| 2785 static const X = ""; | 2801 static const X = ""; |
| 2786 } | 2802 } |
| 2787 '''); | 2803 '''); |
| 2788 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT8, | 2804 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT8, |
| 2789 matcher: isInferStaticVariableTypesInUnitTask); | 2805 matcher: isInferStaticVariableTypesInUnitTask); |
| 2790 CompilationUnit unit = outputs[RESOLVED_UNIT8]; | 2806 CompilationUnit unit = outputs[RESOLVED_UNIT8]; |
| 2791 VariableDeclaration declaration = AstFinder.getFieldInClass(unit, 'M', 'X'); | 2807 VariableDeclaration declaration = AstFinder.getFieldInClass(unit, 'M', 'X'); |
| 2792 InterfaceType stringType = context.typeProvider.stringType; | 2808 InterfaceType stringType = context.typeProvider.stringType; |
| 2793 expect(declaration.element.type, stringType); | 2809 expect(elementForVariableDeclaration(declaration).type, stringType); |
| 2794 } | 2810 } |
| 2795 | 2811 |
| 2796 test_perform_hasParseError() { | 2812 test_perform_hasParseError() { |
| 2797 Source source = newSource( | 2813 Source source = newSource( |
| 2798 '/test.dart', | 2814 '/test.dart', |
| 2799 r''' | 2815 r''' |
| 2800 @(i $= | 2816 @(i $= |
| 2801 '''); | 2817 '''); |
| 2802 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); | 2818 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); |
| 2803 computeResult(target, RESOLVED_UNIT8); | 2819 computeResult(target, RESOLVED_UNIT8); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2846 new LibrarySpecificUnit(secondSource, secondSource), RESOLVED_UNIT8); | 2862 new LibrarySpecificUnit(secondSource, secondSource), RESOLVED_UNIT8); |
| 2847 CompilationUnit secondUnit = outputs[RESOLVED_UNIT8]; | 2863 CompilationUnit secondUnit = outputs[RESOLVED_UNIT8]; |
| 2848 | 2864 |
| 2849 VariableDeclaration variableA = | 2865 VariableDeclaration variableA = |
| 2850 AstFinder.getTopLevelVariable(firstUnit, 'a'); | 2866 AstFinder.getTopLevelVariable(firstUnit, 'a'); |
| 2851 VariableDeclaration variableB = | 2867 VariableDeclaration variableB = |
| 2852 AstFinder.getTopLevelVariable(secondUnit, 'b'); | 2868 AstFinder.getTopLevelVariable(secondUnit, 'b'); |
| 2853 VariableDeclaration variableC = | 2869 VariableDeclaration variableC = |
| 2854 AstFinder.getTopLevelVariable(firstUnit, 'c'); | 2870 AstFinder.getTopLevelVariable(firstUnit, 'c'); |
| 2855 ClassDeclaration classM = AstFinder.getClass(secondUnit, 'M'); | 2871 ClassDeclaration classM = AstFinder.getClass(secondUnit, 'M'); |
| 2856 DartType typeM = classM.element.type; | 2872 DartType typeM = elementForClassDeclaration(classM).type; |
| 2857 | 2873 |
| 2858 expect(variableA.element.type, typeM); | 2874 expect(elementForVariableDeclaration(variableA).type, typeM); |
| 2859 expect(variableB.element.type, typeM); | 2875 expect(elementForVariableDeclaration(variableB).type, typeM); |
| 2860 expect(variableB.initializer.staticType, typeM); | 2876 expect(variableB.initializer.staticType, typeM); |
| 2861 expect(variableC.element.type, typeM); | 2877 expect(elementForVariableDeclaration(variableC).type, typeM); |
| 2862 expect(variableC.initializer.staticType, typeM); | 2878 expect(variableC.initializer.staticType, typeM); |
| 2863 } | 2879 } |
| 2864 | 2880 |
| 2865 void test_perform_simple() { | 2881 void test_perform_simple() { |
| 2866 enableStrongMode(); | 2882 enableStrongMode(); |
| 2867 AnalysisTarget source = newSource( | 2883 AnalysisTarget source = newSource( |
| 2868 '/test.dart', | 2884 '/test.dart', |
| 2869 ''' | 2885 ''' |
| 2870 var X = 1; | 2886 var X = 1; |
| 2871 | 2887 |
| (...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4493 _assertTypeParameterBound( | 4509 _assertTypeParameterBound( |
| 4494 nodeF.typeParameters.typeParameters[0], 'String', 'String'); | 4510 nodeF.typeParameters.typeParameters[0], 'String', 'String'); |
| 4495 } | 4511 } |
| 4496 | 4512 |
| 4497 void _assertTypeParameterBound(TypeParameter typeParameter, | 4513 void _assertTypeParameterBound(TypeParameter typeParameter, |
| 4498 String expectedBoundTypeString, String expectedBoundElementName) { | 4514 String expectedBoundTypeString, String expectedBoundElementName) { |
| 4499 TypeName boundNode = typeParameter.bound; | 4515 TypeName boundNode = typeParameter.bound; |
| 4500 Identifier boundName = boundNode.name; | 4516 Identifier boundName = boundNode.name; |
| 4501 expect(boundNode.type.toString(), expectedBoundTypeString); | 4517 expect(boundNode.type.toString(), expectedBoundTypeString); |
| 4502 expect(boundName.staticType.toString(), expectedBoundTypeString); | 4518 expect(boundName.staticType.toString(), expectedBoundTypeString); |
| 4503 expect(boundName.staticElement.displayName, expectedBoundElementName); | 4519 expect(staticElementForIdentifier(boundName).displayName, |
| 4520 expectedBoundElementName); | |
| 4504 } | 4521 } |
| 4505 } | 4522 } |
| 4506 | 4523 |
| 4507 @reflectiveTest | 4524 @reflectiveTest |
| 4508 class ResolveUnitTaskTest extends _AbstractDartTaskTest { | 4525 class ResolveUnitTaskTest extends _AbstractDartTaskTest { |
| 4509 test_created_resolved_unit() { | 4526 test_created_resolved_unit() { |
| 4510 Source source = newSource( | 4527 Source source = newSource( |
| 4511 '/test.dart', | 4528 '/test.dart', |
| 4512 r''' | 4529 r''' |
| 4513 library lib; | 4530 library lib; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4577 int f(String p) => p.length; | 4594 int f(String p) => p.length; |
| 4578 '''); | 4595 '''); |
| 4579 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); | 4596 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); |
| 4580 computeResult(target, RESOLVED_UNIT5, matcher: isResolveUnitTypeNamesTask); | 4597 computeResult(target, RESOLVED_UNIT5, matcher: isResolveUnitTypeNamesTask); |
| 4581 // validate | 4598 // validate |
| 4582 CompilationUnit unit = outputs[RESOLVED_UNIT5]; | 4599 CompilationUnit unit = outputs[RESOLVED_UNIT5]; |
| 4583 { | 4600 { |
| 4584 ClassDeclaration nodeA = unit.declarations[0]; | 4601 ClassDeclaration nodeA = unit.declarations[0]; |
| 4585 ClassDeclaration nodeB = unit.declarations[1]; | 4602 ClassDeclaration nodeB = unit.declarations[1]; |
| 4586 DartType extendsType = nodeB.extendsClause.superclass.type; | 4603 DartType extendsType = nodeB.extendsClause.superclass.type; |
| 4587 expect(extendsType, nodeA.element.type); | 4604 expect(extendsType, elementForClassDeclaration(nodeA).type); |
| 4588 } | 4605 } |
| 4589 { | 4606 { |
| 4590 FunctionDeclaration functionNode = unit.declarations[2]; | 4607 FunctionDeclaration functionNode = unit.declarations[2]; |
| 4591 DartType returnType = functionNode.returnType.type; | 4608 DartType returnType = functionNode.returnType.type; |
| 4592 List<FormalParameter> parameters = | 4609 List<FormalParameter> parameters = |
| 4593 functionNode.functionExpression.parameters.parameters; | 4610 functionNode.functionExpression.parameters.parameters; |
| 4594 expect(returnType.displayName, 'int'); | 4611 expect(returnType.displayName, 'int'); |
| 4595 expect(parameters[0].element.type.displayName, 'String'); | 4612 expect( |
| 4613 elementForFormalParameter(parameters[0]).type.displayName, 'String'); | |
| 4596 } | 4614 } |
| 4597 } | 4615 } |
| 4598 | 4616 |
| 4599 test_perform_errors() { | 4617 test_perform_errors() { |
| 4600 Source source = newSource( | 4618 Source source = newSource( |
| 4601 '/test.dart', | 4619 '/test.dart', |
| 4602 ''' | 4620 ''' |
| 4603 NoSuchClass f() => null; | 4621 NoSuchClass f() => null; |
| 4604 '''); | 4622 '''); |
| 4605 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); | 4623 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 4619 typedef String G(int p); | 4637 typedef String G(int p); |
| 4620 '''); | 4638 '''); |
| 4621 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); | 4639 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); |
| 4622 computeResult(target, RESOLVED_UNIT5, matcher: isResolveUnitTypeNamesTask); | 4640 computeResult(target, RESOLVED_UNIT5, matcher: isResolveUnitTypeNamesTask); |
| 4623 // validate | 4641 // validate |
| 4624 CompilationUnit unit = outputs[RESOLVED_UNIT5]; | 4642 CompilationUnit unit = outputs[RESOLVED_UNIT5]; |
| 4625 FunctionTypeAlias nodeF = unit.declarations[0]; | 4643 FunctionTypeAlias nodeF = unit.declarations[0]; |
| 4626 FunctionTypeAlias nodeG = unit.declarations[1]; | 4644 FunctionTypeAlias nodeG = unit.declarations[1]; |
| 4627 { | 4645 { |
| 4628 FormalParameter parameter = nodeF.parameters.parameters[0]; | 4646 FormalParameter parameter = nodeF.parameters.parameters[0]; |
| 4629 DartType parameterType = parameter.element.type; | 4647 DartType parameterType = elementForFormalParameter(parameter).type; |
| 4630 Element returnTypeElement = nodeF.returnType.type.element; | 4648 Element returnTypeElement = typeForTypeName(nodeF.returnType).element; |
| 4631 expect(returnTypeElement.displayName, 'int'); | 4649 expect(returnTypeElement.displayName, 'int'); |
| 4632 expect(parameterType.element, nodeG.element); | 4650 expect(parameterType.element, nodeG.element); |
| 4633 } | 4651 } |
| 4634 { | 4652 { |
| 4635 FormalParameter parameter = nodeG.parameters.parameters[0]; | 4653 FormalParameter parameter = nodeG.parameters.parameters[0]; |
| 4636 DartType parameterType = parameter.element.type; | 4654 DartType parameterType = elementForFormalParameter(parameter).type; |
| 4637 expect(nodeG.returnType.type.element.displayName, 'String'); | 4655 expect(typeForTypeName(nodeG.returnType).element.displayName, 'String'); |
| 4638 expect(parameterType.element.displayName, 'int'); | 4656 expect(parameterType.element.displayName, 'int'); |
| 4639 } | 4657 } |
| 4640 } | 4658 } |
| 4641 | 4659 |
| 4642 test_perform_typedef_errors() { | 4660 test_perform_typedef_errors() { |
| 4643 Source source = newSource( | 4661 Source source = newSource( |
| 4644 '/test.dart', | 4662 '/test.dart', |
| 4645 ''' | 4663 ''' |
| 4646 typedef int F(NoSuchType p); | 4664 typedef int F(NoSuchType p); |
| 4647 '''); | 4665 '''); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5298 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT11); | 5316 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT11); |
| 5299 CompilationUnit unit = outputs[RESOLVED_UNIT11]; | 5317 CompilationUnit unit = outputs[RESOLVED_UNIT11]; |
| 5300 | 5318 |
| 5301 InterfaceType intType = context.typeProvider.intType; | 5319 InterfaceType intType = context.typeProvider.intType; |
| 5302 InterfaceType stringType = context.typeProvider.stringType; | 5320 InterfaceType stringType = context.typeProvider.stringType; |
| 5303 | 5321 |
| 5304 List<Statement> statements = | 5322 List<Statement> statements = |
| 5305 AstFinder.getStatementsInTopLevelFunction(unit, "test"); | 5323 AstFinder.getStatementsInTopLevelFunction(unit, "test"); |
| 5306 VariableDeclaration decl = | 5324 VariableDeclaration decl = |
| 5307 (statements[0] as VariableDeclarationStatement).variables.variables[0]; | 5325 (statements[0] as VariableDeclarationStatement).variables.variables[0]; |
| 5308 expect(decl.element.type, intType); | 5326 expect(elementForVariableDeclaration(decl).type, intType); |
| 5309 expect(decl.initializer.staticType, intType); | 5327 expect(decl.initializer.staticType, intType); |
| 5310 | 5328 |
| 5311 ExpressionStatement statement = statements[1]; | 5329 ExpressionStatement statement = statements[1]; |
| 5312 AssignmentExpression assgn = statement.expression; | 5330 AssignmentExpression assgn = statement.expression; |
| 5313 expect(assgn.leftHandSide.staticType, intType); | 5331 expect(assgn.leftHandSide.staticType, intType); |
| 5314 expect(assgn.rightHandSide.staticType, stringType); | 5332 expect(assgn.rightHandSide.staticType, stringType); |
| 5315 } | 5333 } |
| 5316 } | 5334 } |
| 5317 | 5335 |
| 5318 @reflectiveTest | 5336 @reflectiveTest |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5586 | 5604 |
| 5587 void assertVariableDeclarationStatementTypes( | 5605 void assertVariableDeclarationStatementTypes( |
| 5588 Statement stmt, DartType varType, DartType initializerType) { | 5606 Statement stmt, DartType varType, DartType initializerType) { |
| 5589 VariableDeclaration decl = | 5607 VariableDeclaration decl = |
| 5590 (stmt as VariableDeclarationStatement).variables.variables[0]; | 5608 (stmt as VariableDeclarationStatement).variables.variables[0]; |
| 5591 assertVariableDeclarationTypes(decl, varType, initializerType); | 5609 assertVariableDeclarationTypes(decl, varType, initializerType); |
| 5592 } | 5610 } |
| 5593 | 5611 |
| 5594 void assertVariableDeclarationTypes( | 5612 void assertVariableDeclarationTypes( |
| 5595 VariableDeclaration decl, DartType varType, DartType initializerType) { | 5613 VariableDeclaration decl, DartType varType, DartType initializerType) { |
| 5596 expect(decl.element.type, varType); | 5614 expect(elementForVariableDeclaration(decl).type, varType); |
| 5597 expect(decl.initializer.staticType, initializerType); | 5615 expect(decl.initializer.staticType, initializerType); |
| 5598 } | 5616 } |
| 5599 | 5617 |
| 5600 List<dynamic> computeLibraryResults( | 5618 List<dynamic> computeLibraryResults( |
| 5601 List<Source> sources, ResultDescriptor result, | 5619 List<Source> sources, ResultDescriptor result, |
| 5602 {isInstanceOf matcher: null}) { | 5620 {isInstanceOf matcher: null}) { |
| 5603 dynamic compute(Source source) { | 5621 dynamic compute(Source source) { |
| 5604 computeResult(new LibrarySpecificUnit(source, source), result, | 5622 computeResult(new LibrarySpecificUnit(source, source), result, |
| 5605 matcher: matcher); | 5623 matcher: matcher); |
| 5606 return outputs[result]; | 5624 return outputs[result]; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5667 /** | 5685 /** |
| 5668 * Fill [errorListener] with [result] errors in the current [task]. | 5686 * Fill [errorListener] with [result] errors in the current [task]. |
| 5669 */ | 5687 */ |
| 5670 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 5688 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
| 5671 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; | 5689 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; |
| 5672 expect(errors, isNotNull, reason: result.name); | 5690 expect(errors, isNotNull, reason: result.name); |
| 5673 errorListener = new GatheringErrorListener(); | 5691 errorListener = new GatheringErrorListener(); |
| 5674 errorListener.addAll(errors); | 5692 errorListener.addAll(errors); |
| 5675 } | 5693 } |
| 5676 } | 5694 } |
| OLD | NEW |