| 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.src.task.options; | 5 library analyzer.src.task.options; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
| 10 import 'package:analyzer/plugin/options.dart'; | 10 import 'package:analyzer/plugin/options.dart'; |
| 11 import 'package:analyzer/source/analysis_options_provider.dart'; | 11 import 'package:analyzer/source/analysis_options_provider.dart'; |
| 12 import 'package:analyzer/source/error_processor.dart'; | 12 import 'package:analyzer/source/error_processor.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
| 14 import 'package:analyzer/src/generated/java_engine.dart'; | 14 import 'package:analyzer/src/generated/java_engine.dart'; |
| 15 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
| 16 import 'package:analyzer/src/generated/utilities_general.dart'; | 16 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 17 import 'package:analyzer/src/task/general.dart'; | 17 import 'package:analyzer/src/task/general.dart'; |
| 18 import 'package:analyzer/src/task/strong/info.dart'; | |
| 19 import 'package:analyzer/task/general.dart'; | 18 import 'package:analyzer/task/general.dart'; |
| 20 import 'package:analyzer/task/model.dart'; | 19 import 'package:analyzer/task/model.dart'; |
| 21 import 'package:source_span/source_span.dart'; | 20 import 'package:source_span/source_span.dart'; |
| 22 import 'package:yaml/yaml.dart'; | 21 import 'package:yaml/yaml.dart'; |
| 23 | 22 |
| 24 /// The errors produced while parsing an analysis options file. | 23 /// The errors produced while parsing an analysis options file. |
| 25 /// | 24 /// |
| 26 /// The list will be empty if there were no errors, but will not be `null`. | 25 /// The list will be empty if there were no errors, but will not be `null`. |
| 27 final ListResultDescriptor<AnalysisError> ANALYSIS_OPTIONS_ERRORS = | 26 final ListResultDescriptor<AnalysisError> ANALYSIS_OPTIONS_ERRORS = |
| 28 new ListResultDescriptor<AnalysisError>( | 27 new ListResultDescriptor<AnalysisError>( |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 153 |
| 155 /// Lazily populated set of error codes (hashed for speedy lookup). | 154 /// Lazily populated set of error codes (hashed for speedy lookup). |
| 156 static HashSet<String> _errorCodes; | 155 static HashSet<String> _errorCodes; |
| 157 | 156 |
| 158 /// Legal error code names. | 157 /// Legal error code names. |
| 159 static Set<String> get errorCodes { | 158 static Set<String> get errorCodes { |
| 160 if (_errorCodes == null) { | 159 if (_errorCodes == null) { |
| 161 _errorCodes = new HashSet<String>(); | 160 _errorCodes = new HashSet<String>(); |
| 162 // Engine codes. | 161 // Engine codes. |
| 163 _errorCodes.addAll(ErrorCode.values.map((ErrorCode code) => code.name)); | 162 _errorCodes.addAll(ErrorCode.values.map((ErrorCode code) => code.name)); |
| 164 // Strong-mode codes. | |
| 165 _errorCodes.addAll(StaticInfo.names); | |
| 166 } | 163 } |
| 167 return _errorCodes; | 164 return _errorCodes; |
| 168 } | 165 } |
| 169 | 166 |
| 170 @override | 167 @override |
| 171 void validate(ErrorReporter reporter, Map<String, YamlNode> options) { | 168 void validate(ErrorReporter reporter, Map<String, YamlNode> options) { |
| 172 var analyzer = options[AnalyzerOptions.analyzer]; | 169 var analyzer = options[AnalyzerOptions.analyzer]; |
| 173 if (analyzer is YamlMap) { | 170 if (analyzer is YamlMap) { |
| 174 var filters = analyzer[AnalyzerOptions.errors]; | 171 var filters = analyzer[AnalyzerOptions.errors]; |
| 175 if (filters is YamlMap) { | 172 if (filters is YamlMap) { |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 String feature = key.value?.toString(); | 550 String feature = key.value?.toString(); |
| 554 _applyLanguageOption(options, feature, value.value); | 551 _applyLanguageOption(options, feature, value.value); |
| 555 } | 552 } |
| 556 }); | 553 }); |
| 557 } else if (configs is Map) { | 554 } else if (configs is Map) { |
| 558 configs | 555 configs |
| 559 .forEach((key, value) => _applyLanguageOption(options, key, value)); | 556 .forEach((key, value) => _applyLanguageOption(options, key, value)); |
| 560 } | 557 } |
| 561 } | 558 } |
| 562 } | 559 } |
| OLD | NEW |