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

Side by Side Diff: pkg/analyzer/lib/src/task/options.dart

Issue 1892523002: Clean up flags for conditional directives (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months 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
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.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
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698