| 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/visitor.dart'; | 8 import 'package:analyzer/dart/ast/visitor.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 const x = y; | 1139 const x = y; |
| 1140 const y = 1; | 1140 const y = 1; |
| 1141 '''); | 1141 '''); |
| 1142 // First compute the resolved unit for the source. | 1142 // First compute the resolved unit for the source. |
| 1143 LibrarySpecificUnit librarySpecificUnit = | 1143 LibrarySpecificUnit librarySpecificUnit = |
| 1144 new LibrarySpecificUnit(source, source); | 1144 new LibrarySpecificUnit(source, source); |
| 1145 computeResult(librarySpecificUnit, RESOLVED_UNIT1); | 1145 computeResult(librarySpecificUnit, RESOLVED_UNIT1); |
| 1146 CompilationUnit unit = outputs[RESOLVED_UNIT1]; | 1146 CompilationUnit unit = outputs[RESOLVED_UNIT1]; |
| 1147 // Find the elements for the constants x and y. | 1147 // Find the elements for the constants x and y. |
| 1148 List<PropertyAccessorElement> accessors = unit.element.accessors; | 1148 List<PropertyAccessorElement> accessors = unit.element.accessors; |
| 1149 Element x = accessors | 1149 PropertyInducingElement x = accessors |
| 1150 .firstWhere((PropertyAccessorElement accessor) => | 1150 .firstWhere((PropertyAccessorElement accessor) => |
| 1151 accessor.isGetter && accessor.name == 'x') | 1151 accessor.isGetter && accessor.name == 'x') |
| 1152 .variable; | 1152 .variable; |
| 1153 Element y = accessors | 1153 Element y = accessors |
| 1154 .firstWhere((PropertyAccessorElement accessor) => | 1154 .firstWhere((PropertyAccessorElement accessor) => |
| 1155 accessor.isGetter && accessor.name == 'y') | 1155 accessor.isGetter && accessor.name == 'y') |
| 1156 .variable; | 1156 .variable; |
| 1157 // Now compute the dependencies for x, and check that it is the list [y]. | 1157 // Now compute the dependencies for x, and check that it is the list [y]. |
| 1158 computeResult(x, CONSTANT_DEPENDENCIES, | 1158 computeResult(x, CONSTANT_DEPENDENCIES, |
| 1159 matcher: isComputeConstantDependenciesTask); | 1159 matcher: isComputeConstantDependenciesTask); |
| (...skipping 3719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4879 /** | 4879 /** |
| 4880 * Fill [errorListener] with [result] errors in the current [task]. | 4880 * Fill [errorListener] with [result] errors in the current [task]. |
| 4881 */ | 4881 */ |
| 4882 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 4882 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
| 4883 List<AnalysisError> errors = task.outputs[result]; | 4883 List<AnalysisError> errors = task.outputs[result]; |
| 4884 expect(errors, isNotNull, reason: result.name); | 4884 expect(errors, isNotNull, reason: result.name); |
| 4885 errorListener = new GatheringErrorListener(); | 4885 errorListener = new GatheringErrorListener(); |
| 4886 errorListener.addAll(errors); | 4886 errorListener.addAll(errors); |
| 4887 } | 4887 } |
| 4888 } | 4888 } |
| OLD | NEW |