| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 8237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8248 * @param source the source against which the errors should have been reported | 8248 * @param source the source against which the errors should have been reported |
| 8249 * @param expectedErrorCodes the error codes of the errors that should have be
en reported | 8249 * @param expectedErrorCodes the error codes of the errors that should have be
en reported |
| 8250 * @throws AnalysisException if the reported errors could not be computed | 8250 * @throws AnalysisException if the reported errors could not be computed |
| 8251 * @throws AssertionFailedError if a different number of errors have been repo
rted than were | 8251 * @throws AssertionFailedError if a different number of errors have been repo
rted than were |
| 8252 * expected | 8252 * expected |
| 8253 */ | 8253 */ |
| 8254 void assertErrors(Source source, | 8254 void assertErrors(Source source, |
| 8255 [List<ErrorCode> expectedErrorCodes = ErrorCode.EMPTY_LIST]) { | 8255 [List<ErrorCode> expectedErrorCodes = ErrorCode.EMPTY_LIST]) { |
| 8256 GatheringErrorListener errorListener = new GatheringErrorListener(); | 8256 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 8257 for (AnalysisError error in analysisContext2.computeErrors(source)) { | 8257 for (AnalysisError error in analysisContext2.computeErrors(source)) { |
| 8258 expect(error.source, source); |
| 8258 ErrorCode errorCode = error.errorCode; | 8259 ErrorCode errorCode = error.errorCode; |
| 8259 if (!enableUnusedElement && | 8260 if (!enableUnusedElement && |
| 8260 (errorCode == HintCode.UNUSED_ELEMENT || | 8261 (errorCode == HintCode.UNUSED_ELEMENT || |
| 8261 errorCode == HintCode.UNUSED_FIELD)) { | 8262 errorCode == HintCode.UNUSED_FIELD)) { |
| 8262 continue; | 8263 continue; |
| 8263 } | 8264 } |
| 8264 if (!enableUnusedLocalVariable && | 8265 if (!enableUnusedLocalVariable && |
| 8265 (errorCode == HintCode.UNUSED_CATCH_CLAUSE || | 8266 (errorCode == HintCode.UNUSED_CATCH_CLAUSE || |
| 8266 errorCode == HintCode.UNUSED_CATCH_STACK || | 8267 errorCode == HintCode.UNUSED_CATCH_STACK || |
| 8267 errorCode == HintCode.UNUSED_LOCAL_VARIABLE)) { | 8268 errorCode == HintCode.UNUSED_LOCAL_VARIABLE)) { |
| (...skipping 9041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17309 | 17310 |
| 17310 void _resolveTestUnit(String code) { | 17311 void _resolveTestUnit(String code) { |
| 17311 testCode = code; | 17312 testCode = code; |
| 17312 testSource = addSource(testCode); | 17313 testSource = addSource(testCode); |
| 17313 LibraryElement library = resolve2(testSource); | 17314 LibraryElement library = resolve2(testSource); |
| 17314 assertNoErrors(testSource); | 17315 assertNoErrors(testSource); |
| 17315 verify([testSource]); | 17316 verify([testSource]); |
| 17316 testUnit = resolveCompilationUnit(testSource, library); | 17317 testUnit = resolveCompilationUnit(testSource, library); |
| 17317 } | 17318 } |
| 17318 } | 17319 } |
| OLD | NEW |