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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 @x | 174 @x |
175 f() { | 175 f() { |
176 const z = 1; | 176 const z = 1; |
177 } | 177 } |
178 '''); | 178 '''); |
179 CompilationUnit unit = outputs[RESOLVED_UNIT1]; | 179 CompilationUnit unit = outputs[RESOLVED_UNIT1]; |
180 CompilationUnitElement unitElement = outputs[COMPILATION_UNIT_ELEMENT]; | 180 CompilationUnitElement unitElement = outputs[COMPILATION_UNIT_ELEMENT]; |
181 Annotation annotation = unit.declarations | 181 Annotation annotation = unit.declarations |
182 .firstWhere((m) => m is FunctionDeclaration) | 182 .firstWhere((m) => m is FunctionDeclaration) |
183 .metadata[0]; | 183 .metadata[0]; |
184 List<ConstantEvaluationTarget> expectedConstants = [ | 184 List<ConstantEvaluationTarget> expectedConstants = |
Jennifer Messerly
2016/09/15 21:00:33
maybe "var" on left side so the type isn't repeate
Brian Wilkerson
2016/09/15 21:37:26
I would, but there is a sharp pain in the back of
| |
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 annotation.elementAnnotation, |
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 } |
(...skipping 5348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5543 /** | 5544 /** |
5544 * Fill [errorListener] with [result] errors in the current [task]. | 5545 * Fill [errorListener] with [result] errors in the current [task]. |
5545 */ | 5546 */ |
5546 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 5547 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
5547 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; | 5548 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; |
5548 expect(errors, isNotNull, reason: result.name); | 5549 expect(errors, isNotNull, reason: result.name); |
5549 errorListener = new GatheringErrorListener(); | 5550 errorListener = new GatheringErrorListener(); |
5550 errorListener.addAll(errors); | 5551 errorListener.addAll(errors); |
5551 } | 5552 } |
5552 } | 5553 } |
OLD | NEW |