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

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

Issue 2976963002: Add --no-declaration-casts option to analyzer. (Closed)
Patch Set: Fix comment Created 3 years, 5 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/lib/src/task/strong/checker.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 static const String enableSuperMixins = 'enableSuperMixins'; 51 static const String enableSuperMixins = 'enableSuperMixins';
52 52
53 static const String errors = 'errors'; 53 static const String errors = 'errors';
54 static const String exclude = 'exclude'; 54 static const String exclude = 'exclude';
55 static const String include = 'include'; 55 static const String include = 'include';
56 static const String language = 'language'; 56 static const String language = 'language';
57 static const String plugins = 'plugins'; 57 static const String plugins = 'plugins';
58 static const String strong_mode = 'strong-mode'; 58 static const String strong_mode = 'strong-mode';
59 59
60 // Strong mode options, see AnalysisOptionsImpl for documentation. 60 // Strong mode options, see AnalysisOptionsImpl for documentation.
61 static const String declarationCasts = 'declaration-casts';
61 static const String implicitCasts = 'implicit-casts'; 62 static const String implicitCasts = 'implicit-casts';
62 static const String implicitDynamic = 'implicit-dynamic'; 63 static const String implicitDynamic = 'implicit-dynamic';
63 64
64 /// Ways to say `ignore`. 65 /// Ways to say `ignore`.
65 static const List<String> ignoreSynonyms = const ['ignore', 'false']; 66 static const List<String> ignoreSynonyms = const ['ignore', 'false'];
66 67
67 /// Valid error `severity`s. 68 /// Valid error `severity`s.
68 static final List<String> severities = 69 static final List<String> severities =
69 new List.unmodifiable(severityMap.keys); 70 new List.unmodifiable(severityMap.keys);
70 71
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 567
567 void _applyProcessors(AnalysisOptionsImpl options, Object codes) { 568 void _applyProcessors(AnalysisOptionsImpl options, Object codes) {
568 ErrorConfig config = new ErrorConfig(codes); 569 ErrorConfig config = new ErrorConfig(codes);
569 options.errorProcessors = config.processors; 570 options.errorProcessors = config.processors;
570 } 571 }
571 572
572 void _applyStrongModeOption( 573 void _applyStrongModeOption(
573 AnalysisOptionsImpl options, Object feature, Object value) { 574 AnalysisOptionsImpl options, Object feature, Object value) {
574 bool boolValue = toBool(value); 575 bool boolValue = toBool(value);
575 if (boolValue != null) { 576 if (boolValue != null) {
577 if (feature == AnalyzerOptions.declarationCasts) {
578 options.declarationCasts = boolValue;
579 }
576 if (feature == AnalyzerOptions.implicitCasts) { 580 if (feature == AnalyzerOptions.implicitCasts) {
577 options.implicitCasts = boolValue; 581 options.implicitCasts = boolValue;
578 } 582 }
579 if (feature == AnalyzerOptions.implicitDynamic) { 583 if (feature == AnalyzerOptions.implicitDynamic) {
580 options.implicitDynamic = boolValue; 584 options.implicitDynamic = boolValue;
581 } 585 }
582 } 586 }
583 } 587 }
584 588
585 void _applyStrongOptions(AnalysisOptionsImpl options, Object config) { 589 void _applyStrongOptions(AnalysisOptionsImpl options, Object config) {
586 if (config is YamlMap) { 590 if (config is YamlMap) {
587 options.strongMode = true; 591 options.strongMode = true;
588 config.nodes.forEach((k, v) { 592 config.nodes.forEach((k, v) {
589 if (k is YamlScalar && v is YamlScalar) { 593 if (k is YamlScalar && v is YamlScalar) {
590 _applyStrongModeOption(options, k.value?.toString(), v.value); 594 _applyStrongModeOption(options, k.value?.toString(), v.value);
591 } 595 }
592 }); 596 });
593 } else if (config is Map) { 597 } else if (config is Map) {
594 options.strongMode = true; 598 options.strongMode = true;
595 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); 599 config.forEach((k, v) => _applyStrongModeOption(options, k, v));
596 } else { 600 } else {
597 options.strongMode = config is bool ? config : false; 601 options.strongMode = config is bool ? config : false;
598 } 602 }
599 } 603 }
600 } 604 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698