| 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 29 matching lines...) Expand all Loading... |
| 40 AnalysisContext context, Map<String, Object> options) => | 40 AnalysisContext context, Map<String, Object> options) => |
| 41 _processor.configure(context, options); | 41 _processor.configure(context, options); |
| 42 | 42 |
| 43 /// `analyzer` analysis options constants. | 43 /// `analyzer` analysis options constants. |
| 44 class AnalyzerOptions { | 44 class AnalyzerOptions { |
| 45 static const String analyzer = 'analyzer'; | 45 static const String analyzer = 'analyzer'; |
| 46 static const String enableAsync = 'enableAsync'; | 46 static const String enableAsync = 'enableAsync'; |
| 47 static const String enableGenericMethods = 'enableGenericMethods'; | 47 static const String enableGenericMethods = 'enableGenericMethods'; |
| 48 static const String enableStrictCallChecks = 'enableStrictCallChecks'; | 48 static const String enableStrictCallChecks = 'enableStrictCallChecks'; |
| 49 static const String enableSuperMixins = 'enableSuperMixins'; | 49 static const String enableSuperMixins = 'enableSuperMixins'; |
| 50 static const String enableTrailingCommas = 'enableTrailingCommas'; |
| 50 | 51 |
| 51 /// This option is deprecated. | 52 /// This option is deprecated. |
| 52 static const String enableConditionalDirectives = | 53 static const String enableConditionalDirectives = |
| 53 "enableConditionalDirectives"; | 54 "enableConditionalDirectives"; |
| 54 static const String errors = 'errors'; | 55 static const String errors = 'errors'; |
| 55 static const String exclude = 'exclude'; | 56 static const String exclude = 'exclude'; |
| 56 static const String language = 'language'; | 57 static const String language = 'language'; |
| 57 static const String plugins = 'plugins'; | 58 static const String plugins = 'plugins'; |
| 58 static const String strong_mode = 'strong-mode'; | 59 static const String strong_mode = 'strong-mode'; |
| 59 | 60 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 } | 482 } |
| 482 } | 483 } |
| 483 if (feature == AnalyzerOptions.enableSuperMixins) { | 484 if (feature == AnalyzerOptions.enableSuperMixins) { |
| 484 if (isTrue(value)) { | 485 if (isTrue(value)) { |
| 485 AnalysisOptionsImpl options = | 486 AnalysisOptionsImpl options = |
| 486 new AnalysisOptionsImpl.from(context.analysisOptions); | 487 new AnalysisOptionsImpl.from(context.analysisOptions); |
| 487 options.enableSuperMixins = true; | 488 options.enableSuperMixins = true; |
| 488 context.analysisOptions = options; | 489 context.analysisOptions = options; |
| 489 } | 490 } |
| 490 } | 491 } |
| 492 if (feature == AnalyzerOptions.enableTrailingCommas) { |
| 493 if (isTrue(value)) { |
| 494 AnalysisOptionsImpl options = |
| 495 new AnalysisOptionsImpl.from(context.analysisOptions); |
| 496 options.enableTrailingCommas = true; |
| 497 context.analysisOptions = options; |
| 498 } |
| 499 } |
| 491 if (feature == AnalyzerOptions.enableGenericMethods) { | 500 if (feature == AnalyzerOptions.enableGenericMethods) { |
| 492 if (isTrue(value)) { | 501 if (isTrue(value)) { |
| 493 AnalysisOptionsImpl options = | 502 AnalysisOptionsImpl options = |
| 494 new AnalysisOptionsImpl.from(context.analysisOptions); | 503 new AnalysisOptionsImpl.from(context.analysisOptions); |
| 495 options.enableGenericMethods = true; | 504 options.enableGenericMethods = true; |
| 496 context.analysisOptions = options; | 505 context.analysisOptions = options; |
| 497 } | 506 } |
| 498 } | 507 } |
| 499 } | 508 } |
| 500 | 509 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 String feature = key.value?.toString(); | 559 String feature = key.value?.toString(); |
| 551 _applyLanguageOption(options, feature, value.value); | 560 _applyLanguageOption(options, feature, value.value); |
| 552 } | 561 } |
| 553 }); | 562 }); |
| 554 } else if (configs is Map) { | 563 } else if (configs is Map) { |
| 555 configs | 564 configs |
| 556 .forEach((key, value) => _applyLanguageOption(options, key, value)); | 565 .forEach((key, value) => _applyLanguageOption(options, key, value)); |
| 557 } | 566 } |
| 558 } | 567 } |
| 559 } | 568 } |
| OLD | NEW |