Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: pkg/analyzer/test/src/task/strong/strong_test_helper.dart

Issue 2566013002: Implement 'analysis.getErrors' for the new driver. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/test/source/error_processor_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 final prefix = 'STRONG_MODE_'; 168 final prefix = 'STRONG_MODE_';
169 if (name.startsWith(prefix)) { 169 if (name.startsWith(prefix)) {
170 return name.substring(prefix.length); 170 return name.substring(prefix.length);
171 } else { 171 } else {
172 return name; 172 return name;
173 } 173 }
174 } 174 }
175 175
176 ErrorSeverity _errorSeverity(AnalysisContext context, AnalysisError error) { 176 ErrorSeverity _errorSeverity(AnalysisContext context, AnalysisError error) {
177 // Attempt to process severity in a similar way to analyzer_cli and server. 177 // Attempt to process severity in a similar way to analyzer_cli and server.
178 return ErrorProcessor.getProcessor(context, error)?.severity ?? 178 return ErrorProcessor
179 .getProcessor(context.analysisOptions, error)
180 ?.severity ??
179 error.errorCode.errorSeverity; 181 error.errorCode.errorSeverity;
180 } 182 }
181 183
182 void _expectErrors(AnalysisContext context, CompilationUnit unit, 184 void _expectErrors(AnalysisContext context, CompilationUnit unit,
183 List<AnalysisError> actualErrors) { 185 List<AnalysisError> actualErrors) {
184 var expectedErrors = _findExpectedErrors(unit.beginToken); 186 var expectedErrors = _findExpectedErrors(unit.beginToken);
185 187
186 // Sort both lists: by offset, then level, then name. 188 // Sort both lists: by offset, then level, then name.
187 actualErrors.sort((x, y) { 189 actualErrors.sort((x, y) {
188 int delta = x.offset.compareTo(y.offset); 190 int delta = x.offset.compareTo(y.offset);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 @override 408 @override
407 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 409 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
408 if (uri.scheme == 'package') { 410 if (uri.scheme == 'package') {
409 return (provider.getResource( 411 return (provider.getResource(
410 provider.convertPath('/packages/' + uri.path)) as File) 412 provider.convertPath('/packages/' + uri.path)) as File)
411 .createSource(uri); 413 .createSource(uri);
412 } 414 }
413 return super.resolveAbsolute(uri, actualUri); 415 return super.resolveAbsolute(uri, actualUri);
414 } 416 }
415 } 417 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/source/error_processor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698