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

Unified Diff: pkg/analyzer/lib/src/generated/type_system.dart

Issue 2205743002: Add non-null types list to StrongModeOptions (Closed) Base URL: https://github.com/dart-lang/sdk@master
Patch Set: Address comments Created 4 years, 4 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
Index: pkg/analyzer/lib/src/generated/type_system.dart
diff --git a/pkg/analyzer/lib/src/generated/type_system.dart b/pkg/analyzer/lib/src/generated/type_system.dart
index 828cae2cb1f29ed020f765754fa4bebaef751e59..0138526a9d239316da15ec1329bcefa1075423c6 100644
--- a/pkg/analyzer/lib/src/generated/type_system.dart
+++ b/pkg/analyzer/lib/src/generated/type_system.dart
@@ -31,7 +31,14 @@ class StrongTypeSystemImpl extends TypeSystem {
*/
final bool implicitCasts;
- StrongTypeSystemImpl({this.implicitCasts: true});
+ /**
+ * A list of non-nullable type names (e.g., 'int', 'bool', etc.).
+ */
+ final List<String> nonnullableTypes;
+
+ StrongTypeSystemImpl(
+ {this.implicitCasts: true,
+ this.nonnullableTypes: AnalysisOptionsImpl.NONNULLABLE_TYPES});
bool anyParameterType(FunctionType ft, bool predicate(DartType t)) {
return ft.parameters.any((p) => predicate(p.type));
@@ -1186,7 +1193,9 @@ abstract class TypeSystem {
static TypeSystem create(AnalysisContext context) {
var options = context.analysisOptions as AnalysisOptionsImpl;
return options.strongMode
- ? new StrongTypeSystemImpl(implicitCasts: options.implicitCasts)
+ ? new StrongTypeSystemImpl(
+ implicitCasts: options.implicitCasts,
+ nonnullableTypes: options.nonnullableTypes)
: new TypeSystemImpl();
}
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/src/task/strong/non_null_checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698