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

Unified Diff: lib/strong_mode.dart

Issue 1395643004: remove most of the StrongOptions (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebase Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/checker/rules.dart ('k') | test/checker/checker_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/strong_mode.dart
diff --git a/lib/strong_mode.dart b/lib/strong_mode.dart
index eb0091a0c5931d79fec815b7d7913b0fd0d1219b..6a4366e65bae438e6c1efe919042c3bc4b23e1e0 100644
--- a/lib/strong_mode.dart
+++ b/lib/strong_mode.dart
@@ -78,54 +78,18 @@ class _ErrorCollector implements AnalysisErrorListener {
}
}
+// TODO(jmesserly): this type is dead now. It's preserved because analyzer_cli
+// passes the `hints` option.
class StrongModeOptions {
- /// Whether to infer types for consts and fields by looking at initializers on
- /// the RHS. For example, in a constant declaration like:
- ///
- /// const A = B;
- ///
- /// We can infer the type of `A` based on the type of `B`.
- ///
- /// The inference algorithm determines what variables depend on others, and
- /// computes types by visiting the variable dependency graph in topological
- /// order. This ensures that the inferred type is deterministic when applying
- /// inference on library cycles.
- ///
- /// When this feature is turned off, we don't use the type of `B` to infer the
- /// type of `A`, even if `B` has a declared type.
- final bool inferTransitively;
- static const inferTransitivelyDefault = true;
-
- /// Restrict inference of fields and top-levels to those that are final and
- /// const.
- final bool onlyInferConstsAndFinalFields;
- static const onlyInferConstAndFinalFieldsDefault = false;
-
- /// Whether to infer types downwards from local context
- final bool inferDownwards;
- static const inferDownwardsDefault = true;
-
- /// Whether to inject casts between Dart assignable types.
- final bool relaxedCasts;
-
/// Whether to include hints about dynamic invokes and runtime checks.
// TODO(jmesserly): this option is not used yet by DDC server mode or batch
// compile to JS.
final bool hints;
- const StrongModeOptions(
- {this.hints: false,
- this.inferTransitively: inferTransitivelyDefault,
- this.onlyInferConstsAndFinalFields: onlyInferConstAndFinalFieldsDefault,
- this.inferDownwards: inferDownwardsDefault,
- this.relaxedCasts: true});
+ const StrongModeOptions({this.hints: false});
StrongModeOptions.fromArguments(ArgResults args, {String prefix: ''})
- : relaxedCasts = args[prefix + 'relaxed-casts'],
- inferDownwards = args[prefix + 'infer-downwards'],
- inferTransitively = args[prefix + 'infer-transitively'],
- onlyInferConstsAndFinalFields = args[prefix + 'infer-only-finals'],
- hints = args[prefix + 'hints'];
+ : hints = args[prefix + 'hints'];
static ArgParser addArguments(ArgParser parser,
{String prefix: '', bool hide: false}) {
@@ -133,36 +97,12 @@ class StrongModeOptions {
..addFlag(prefix + 'hints',
help: 'Display hints about dynamic casts and dispatch operations',
defaultsTo: false,
- hide: hide)
- ..addFlag(prefix + 'relaxed-casts',
- help: 'Cast between Dart assignable types',
- defaultsTo: true,
- hide: hide)
- ..addOption(prefix + 'nonnullable',
- abbr: prefix == '' ? 'n' : null,
- help: 'Comma separated string of non-nullable types',
- defaultsTo: null,
- hide: hide)
- ..addFlag(prefix + 'infer-downwards',
- help: 'Infer types downwards from local context',
- defaultsTo: inferDownwardsDefault,
- hide: hide)
- ..addFlag(prefix + 'infer-transitively',
- help: 'Infer consts/fields from definitions in other libraries',
- defaultsTo: inferTransitivelyDefault,
- hide: hide)
- ..addFlag(prefix + 'infer-only-finals',
- help: 'Do not infer non-const or non-final fields',
- defaultsTo: onlyInferConstAndFinalFieldsDefault,
hide: hide);
}
bool operator ==(Object other) {
if (other is! StrongModeOptions) return false;
StrongModeOptions s = other;
- return inferTransitively == s.inferTransitively &&
- onlyInferConstsAndFinalFields == s.onlyInferConstsAndFinalFields &&
- inferDownwards == s.inferDownwards &&
- relaxedCasts == s.relaxedCasts;
+ return hints == s.hints;
}
}
« no previous file with comments | « lib/src/checker/rules.dart ('k') | test/checker/checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698