| 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'; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 AnalysisContext context, Map<String, Object> options) => | 41 AnalysisContext context, Map<String, Object> options) => |
| 42 _processor.configure(context, options); | 42 _processor.configure(context, options); |
| 43 | 43 |
| 44 /// `analyzer` analysis options constants. | 44 /// `analyzer` analysis options constants. |
| 45 class AnalyzerOptions { | 45 class AnalyzerOptions { |
| 46 static const String analyzer = 'analyzer'; | 46 static const String analyzer = 'analyzer'; |
| 47 static const String enableAsync = 'enableAsync'; | 47 static const String enableAsync = 'enableAsync'; |
| 48 static const String enableGenericMethods = 'enableGenericMethods'; | 48 static const String enableGenericMethods = 'enableGenericMethods'; |
| 49 static const String enableStrictCallChecks = 'enableStrictCallChecks'; | 49 static const String enableStrictCallChecks = 'enableStrictCallChecks'; |
| 50 static const String enableSuperMixins = 'enableSuperMixins'; | 50 static const String enableSuperMixins = 'enableSuperMixins'; |
| 51 |
| 52 /// This option is deprecated. |
| 51 static const String enableConditionalDirectives = | 53 static const String enableConditionalDirectives = |
| 52 "enableConditionalDirectives"; | 54 "enableConditionalDirectives"; |
| 53 static const String errors = 'errors'; | 55 static const String errors = 'errors'; |
| 54 static const String exclude = 'exclude'; | 56 static const String exclude = 'exclude'; |
| 55 static const String language = 'language'; | 57 static const String language = 'language'; |
| 56 static const String plugins = 'plugins'; | 58 static const String plugins = 'plugins'; |
| 57 static const String strong_mode = 'strong-mode'; | 59 static const String strong_mode = 'strong-mode'; |
| 58 | 60 |
| 59 /// Ways to say `ignore`. | 61 /// Ways to say `ignore`. |
| 60 static const List<String> ignoreSynonyms = const ['ignore', 'false']; | 62 static const List<String> ignoreSynonyms = const ['ignore', 'false']; |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 } | 491 } |
| 490 } | 492 } |
| 491 if (feature == AnalyzerOptions.enableGenericMethods) { | 493 if (feature == AnalyzerOptions.enableGenericMethods) { |
| 492 if (isTrue(value)) { | 494 if (isTrue(value)) { |
| 493 AnalysisOptionsImpl options = | 495 AnalysisOptionsImpl options = |
| 494 new AnalysisOptionsImpl.from(context.analysisOptions); | 496 new AnalysisOptionsImpl.from(context.analysisOptions); |
| 495 options.enableGenericMethods = true; | 497 options.enableGenericMethods = true; |
| 496 context.analysisOptions = options; | 498 context.analysisOptions = options; |
| 497 } | 499 } |
| 498 } | 500 } |
| 499 if (feature == AnalyzerOptions.enableConditionalDirectives) { | |
| 500 if (isTrue(value)) { | |
| 501 AnalysisOptionsImpl options = | |
| 502 new AnalysisOptionsImpl.from(context.analysisOptions); | |
| 503 options.enableConditionalDirectives = true; | |
| 504 context.analysisOptions = options; | |
| 505 } | |
| 506 } | |
| 507 } | 501 } |
| 508 | 502 |
| 509 void setLanguageOptions(AnalysisContext context, Object configs) { | 503 void setLanguageOptions(AnalysisContext context, Object configs) { |
| 510 if (configs is YamlMap) { | 504 if (configs is YamlMap) { |
| 511 configs.nodes.forEach((k, v) { | 505 configs.nodes.forEach((k, v) { |
| 512 if (k is YamlScalar && v is YamlScalar) { | 506 if (k is YamlScalar && v is YamlScalar) { |
| 513 String feature = k.value?.toString(); | 507 String feature = k.value?.toString(); |
| 514 setLanguageOption(context, feature, v.value); | 508 setLanguageOption(context, feature, v.value); |
| 515 } | 509 } |
| 516 }); | 510 }); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 String feature = key.value?.toString(); | 552 String feature = key.value?.toString(); |
| 559 _applyLanguageOption(options, feature, value.value); | 553 _applyLanguageOption(options, feature, value.value); |
| 560 } | 554 } |
| 561 }); | 555 }); |
| 562 } else if (configs is Map) { | 556 } else if (configs is Map) { |
| 563 configs | 557 configs |
| 564 .forEach((key, value) => _applyLanguageOption(options, key, value)); | 558 .forEach((key, value) => _applyLanguageOption(options, key, value)); |
| 565 } | 559 } |
| 566 } | 560 } |
| 567 } | 561 } |
| OLD | NEW |