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

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

Issue 2781443003: Fix #28120, strong mode allows field overrides (Closed)
Patch Set: fix Created 3 years, 9 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/dev_compiler/lib/src/compiler/nullable_type_inference.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart b/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
index 796811370f0062a4597812705ac9013670f8c09c..dbba17103ecbab2aa55ccc7736710580ac6de378 100644
--- a/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
+++ b/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
@@ -10,6 +10,7 @@ import 'package:analyzer/dart/ast/visitor.dart' show RecursiveAstVisitor;
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'element_helpers.dart' show getStaticType, isInlineJS;
+import 'property_model.dart';
/// An inference engine for nullable types.
///
@@ -23,6 +24,8 @@ import 'element_helpers.dart' show getStaticType, isInlineJS;
// better non-nullability in the type system.
abstract class NullableTypeInference {
LibraryElement get dartCoreLibrary;
+ VirtualFieldModel get virtualFields;
+
bool isPrimitiveType(DartType type);
bool isObjectMember(String name);
@@ -81,7 +84,8 @@ abstract class NullableTypeInference {
if (element is PropertyAccessorElement && element.isGetter) {
PropertyInducingElement variable = element.variable;
- var isVirtual = variable is FieldElement && variable.isVirtual;
+ var isVirtual =
+ variable is FieldElement && virtualFields.isVirtual(variable);
return isVirtual || (variable.computeConstantValue()?.isNull ?? true);
}
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/element_helpers.dart ('k') | pkg/dev_compiler/lib/src/compiler/property_model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698