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

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

Issue 2200263004: Disallow assigning null to non-nullable variables (Closed) Base URL: https://github.com/dart-lang/sdk@master
Patch Set: Address lgtm comment 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
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0138526a9d239316da15ec1329bcefa1075423c6..c99ae6c0246703a632637d998c8c085b954b18a0 100644
--- a/pkg/analyzer/lib/src/generated/type_system.dart
+++ b/pkg/analyzer/lib/src/generated/type_system.dart
@@ -763,6 +763,16 @@ class StrongTypeSystemImpl extends TypeSystem {
return (t.isDynamic && !dynamicIsBottom) || t.isObject;
}
+ bool isNonNullableType(DartType type) {
+ return nonnullableTypes.contains(_getTypeFullyQualifiedName(type));
+ }
+
+ /// Given a type return its name prepended with the URI to its containing
+ /// library and separated by a comma.
+ String _getTypeFullyQualifiedName(DartType type) {
+ return "${type?.element?.library?.source?.uri},$type";
+ }
+
/**
* This currently just implements a simple least upper bound to
* handle some common cases. It also avoids some termination issues
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698