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

Unified Diff: lib/src/compiler/nullable_type_inference.dart

Issue 1986683002: Named constants are (usually) not null. (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Created 4 years, 7 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/runtime/dart_sdk.js ('k') | test/codegen/expect/fieldtest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/compiler/nullable_type_inference.dart
diff --git a/lib/src/compiler/nullable_type_inference.dart b/lib/src/compiler/nullable_type_inference.dart
index 0cbfd4ccd728cd30ee3841a696b6c834a9617331..706d677eacab6bb697116d0505632408544eb2fb 100644
--- a/lib/src/compiler/nullable_type_inference.dart
+++ b/lib/src/compiler/nullable_type_inference.dart
@@ -78,6 +78,11 @@ abstract class NullableTypeInference {
return false;
}
+ if (element is PropertyAccessorElement && element.isGetter) {
+ PropertyInducingElement variable = element.variable;
+ return variable.constantValue?.isNull ?? true;
+ }
+
// Other types of identifiers are nullable (parameters, fields).
return true;
}
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | test/codegen/expect/fieldtest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698