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

Side by Side Diff: pkg/analyzer/lib/source/error_processor.dart

Issue 2522543007: Remove uses of configuration data (Closed)
Patch Set: clean-up 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
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 library analyzer.source.error_processor; 5 library analyzer.source.error_processor;
6 6
7 import 'package:analyzer/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/error/codes.dart'; 8 import 'package:analyzer/src/error/codes.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/utilities_general.dart'; 10 import 'package:analyzer/src/generated/utilities_general.dart';
11 import 'package:analyzer/src/task/options.dart'
12 show CONFIGURED_ERROR_PROCESSORS;
13 import 'package:analyzer/src/task/options.dart'; 11 import 'package:analyzer/src/task/options.dart';
14 import 'package:yaml/yaml.dart'; 12 import 'package:yaml/yaml.dart';
15 13
16 /// String identifiers mapped to associated severities. 14 /// String identifiers mapped to associated severities.
17 const Map<String, ErrorSeverity> severityMap = const { 15 const Map<String, ErrorSeverity> severityMap = const {
18 'error': ErrorSeverity.ERROR, 16 'error': ErrorSeverity.ERROR,
19 'info': ErrorSeverity.INFO, 17 'info': ErrorSeverity.INFO,
20 'warning': ErrorSeverity.WARNING 18 'warning': ErrorSeverity.WARNING
21 }; 19 };
22 20
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 89
92 /// Return an error processor associated with this [context] for the given 90 /// Return an error processor associated with this [context] for the given
93 /// [error], or `null` if none is found. 91 /// [error], or `null` if none is found.
94 static ErrorProcessor getProcessor( 92 static ErrorProcessor getProcessor(
95 AnalysisContext context, AnalysisError error) { 93 AnalysisContext context, AnalysisError error) {
96 if (context == null) { 94 if (context == null) {
97 return null; 95 return null;
98 } 96 }
99 97
100 // Let the user configure how specific errors are processed. 98 // Let the user configure how specific errors are processed.
101 List<ErrorProcessor> processors = 99 List<ErrorProcessor> processors = context.analysisOptions.errorProcessors;
102 context.getConfigurationData(CONFIGURED_ERROR_PROCESSORS);
103 100
104 // Give strong mode a chance to upgrade it. 101 // Give strong mode a chance to upgrade it.
105 if (context.analysisOptions.strongMode) { 102 if (context.analysisOptions.strongMode) {
106 processors = processors.toList(); 103 processors = processors.toList();
107 processors.add(_StrongModeTypeErrorProcessor.instance); 104 processors.add(_StrongModeTypeErrorProcessor.instance);
108 } 105 }
109 return processors.firstWhere((ErrorProcessor p) => p.appliesTo(error), 106 return processors.firstWhere((ErrorProcessor p) => p.appliesTo(error),
110 orElse: () => null); 107 orElse: () => null);
111 } 108 }
112 } 109 }
(...skipping 15 matching lines...) Expand all
128 ErrorCode errorCode = error.errorCode; 125 ErrorCode errorCode = error.errorCode;
129 if (errorCode is StaticTypeWarningCode) { 126 if (errorCode is StaticTypeWarningCode) {
130 return true; 127 return true;
131 } 128 }
132 if (errorCode is StaticWarningCode) { 129 if (errorCode is StaticWarningCode) {
133 return errorCode.isStrongModeError; 130 return errorCode.isStrongModeError;
134 } 131 }
135 return false; 132 return false;
136 } 133 }
137 } 134 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/context_manager_test.dart ('k') | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698