| 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 // TODO(jmesserly): this file needs to be refactored, it's a port from | 5 // TODO(jmesserly): this file needs to be refactored, it's a port from |
| 6 // package:dev_compiler's tests | 6 // package:dev_compiler's tests |
| 7 library analyzer.test.src.task.strong.strong_test_helper; | 7 library analyzer.test.src.task.strong.strong_test_helper; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 final prefix = 'STRONG_MODE_'; | 60 final prefix = 'STRONG_MODE_'; |
| 61 if (name.startsWith(prefix)) { | 61 if (name.startsWith(prefix)) { |
| 62 return name.substring(prefix.length); | 62 return name.substring(prefix.length); |
| 63 } else { | 63 } else { |
| 64 return name; | 64 return name; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 ErrorSeverity _errorSeverity( | 68 ErrorSeverity _errorSeverity( |
| 69 AnalysisOptions analysisOptions, AnalysisError error) { | 69 AnalysisOptions analysisOptions, AnalysisError error) { |
| 70 // TODO(brianwilkerson) Remove the if when top-level inference is made an |
| 71 // error again. |
| 72 if (error.errorCode.name.startsWith('STRONG_MODE_TOP_LEVEL_')) { |
| 73 return ErrorSeverity.ERROR; |
| 74 } |
| 70 return ErrorProcessor.getProcessor(analysisOptions, error)?.severity ?? | 75 return ErrorProcessor.getProcessor(analysisOptions, error)?.severity ?? |
| 71 error.errorCode.errorSeverity; | 76 error.errorCode.errorSeverity; |
| 72 } | 77 } |
| 73 | 78 |
| 74 void _expectErrors(AnalysisOptions analysisOptions, CompilationUnit unit, | 79 void _expectErrors(AnalysisOptions analysisOptions, CompilationUnit unit, |
| 75 List<AnalysisError> actualErrors) { | 80 List<AnalysisError> actualErrors) { |
| 76 var expectedErrors = _findExpectedErrors(unit.beginToken); | 81 var expectedErrors = _findExpectedErrors(unit.beginToken); |
| 77 | 82 |
| 78 // Sort both lists: by offset, then level, then name. | 83 // Sort both lists: by offset, then level, then name. |
| 79 actualErrors.sort((x, y) { | 84 actualErrors.sort((x, y) { |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 @override | 473 @override |
| 469 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 474 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 470 if (uri.scheme == 'package') { | 475 if (uri.scheme == 'package') { |
| 471 return (provider.getResource( | 476 return (provider.getResource( |
| 472 provider.convertPath('/packages/' + uri.path)) as File) | 477 provider.convertPath('/packages/' + uri.path)) as File) |
| 473 .createSource(uri); | 478 .createSource(uri); |
| 474 } | 479 } |
| 475 return super.resolveAbsolute(uri, actualUri); | 480 return super.resolveAbsolute(uri, actualUri); |
| 476 } | 481 } |
| 477 } | 482 } |
| OLD | NEW |