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 void configureContextOptions( | 41 void configureContextOptions( |
42 AnalysisContext context, Map<String, Object> options) => | 42 AnalysisContext context, Map<String, Object> options) => |
43 _processor.configure(context, options); | 43 _processor.configure(context, options); |
44 | 44 |
45 /// `analyzer` analysis options constants. | 45 /// `analyzer` analysis options constants. |
46 class AnalyzerOptions { | 46 class AnalyzerOptions { |
47 static const String analyzer = 'analyzer'; | 47 static const String analyzer = 'analyzer'; |
48 static const String enableAssertInitializer = 'enableAssertInitializer'; | 48 static const String enableAssertInitializer = 'enableAssertInitializer'; |
49 static const String enableAsync = 'enableAsync'; | 49 static const String enableAsync = 'enableAsync'; |
50 static const String enableGenericMethods = 'enableGenericMethods'; | 50 static const String enableGenericMethods = 'enableGenericMethods'; |
| 51 static const String enableInitializingFormalAccess = |
| 52 'enableInitializingFormalAccess'; |
51 static const String enableStrictCallChecks = 'enableStrictCallChecks'; | 53 static const String enableStrictCallChecks = 'enableStrictCallChecks'; |
52 static const String enableSuperMixins = 'enableSuperMixins'; | 54 static const String enableSuperMixins = 'enableSuperMixins'; |
53 | 55 |
54 static const String errors = 'errors'; | 56 static const String errors = 'errors'; |
55 static const String exclude = 'exclude'; | 57 static const String exclude = 'exclude'; |
56 static const String language = 'language'; | 58 static const String language = 'language'; |
57 static const String plugins = 'plugins'; | 59 static const String plugins = 'plugins'; |
58 static const String strong_mode = 'strong-mode'; | 60 static const String strong_mode = 'strong-mode'; |
59 | 61 |
60 // Strong mode options, see AnalysisOptionsImpl for documentation. | 62 // Strong mode options, see AnalysisOptionsImpl for documentation. |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 } | 561 } |
560 | 562 |
561 void _applyLanguageOption( | 563 void _applyLanguageOption( |
562 AnalysisOptionsImpl options, Object feature, Object value) { | 564 AnalysisOptionsImpl options, Object feature, Object value) { |
563 bool boolValue = toBool(value); | 565 bool boolValue = toBool(value); |
564 if (boolValue != null) { | 566 if (boolValue != null) { |
565 if (feature == AnalyzerOptions.enableAssertInitializer) { | 567 if (feature == AnalyzerOptions.enableAssertInitializer) { |
566 options.enableAssertInitializer = boolValue; | 568 options.enableAssertInitializer = boolValue; |
567 } else if (feature == AnalyzerOptions.enableAsync) { | 569 } else if (feature == AnalyzerOptions.enableAsync) { |
568 options.enableAsync = boolValue; | 570 options.enableAsync = boolValue; |
| 571 } else if (feature == AnalyzerOptions.enableInitializingFormalAccess) { |
| 572 options.enableInitializingFormalAccess = boolValue; |
569 } else if (feature == AnalyzerOptions.enableSuperMixins) { | 573 } else if (feature == AnalyzerOptions.enableSuperMixins) { |
570 options.enableSuperMixins = boolValue; | 574 options.enableSuperMixins = boolValue; |
571 } else if (feature == AnalyzerOptions.enableGenericMethods) { | 575 } else if (feature == AnalyzerOptions.enableGenericMethods) { |
572 options.enableGenericMethods = boolValue; | 576 options.enableGenericMethods = boolValue; |
573 } | 577 } |
574 } | 578 } |
575 } | 579 } |
576 | 580 |
577 void _applyLanguageOptions(AnalysisOptionsImpl options, Object configs) { | 581 void _applyLanguageOptions(AnalysisOptionsImpl options, Object configs) { |
578 if (configs is YamlMap) { | 582 if (configs is YamlMap) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 } | 614 } |
611 }); | 615 }); |
612 } else if (config is Map) { | 616 } else if (config is Map) { |
613 options.strongMode = true; | 617 options.strongMode = true; |
614 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); | 618 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); |
615 } else { | 619 } else { |
616 options.strongMode = config is bool ? config : false; | 620 options.strongMode = config is bool ? config : false; |
617 } | 621 } |
618 } | 622 } |
619 } | 623 } |
OLD | NEW |