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

Unified Diff: pkg/analyzer/lib/src/task/strong_mode.dart

Issue 2777733002: Update final fields inference according to the clarified specification. (Closed)
Patch Set: 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
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | pkg/analyzer/test/src/summary/top_level_inference_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/strong_mode.dart
diff --git a/pkg/analyzer/lib/src/task/strong_mode.dart b/pkg/analyzer/lib/src/task/strong_mode.dart
index a1fe104e11b64c0f2f8b570219435fc8afbb3507..dcc55f1840e7ebb86320a533767f669030ae27f6 100644
--- a/pkg/analyzer/lib/src/task/strong_mode.dart
+++ b/pkg/analyzer/lib/src/task/strong_mode.dart
@@ -114,25 +114,27 @@ class InstanceMemberInferrer {
}
/**
- * Compute the inferred type for the given property accessor [element]. The
- * returned value is never `null`, but might be an error, and/or have the
- * `null` type.
+ * Compute the inferred type for the given property [accessor]. The returned
+ * value is never `null`, but might be an error, and/or have the `null` type.
*/
_FieldOverrideInferenceResult _computeFieldOverrideType(
- ExecutableElement element) {
- String name = element.displayName;
+ PropertyAccessorElement accessor) {
+ String name = accessor.displayName;
var overriddenElements = <ExecutableElement>[];
overriddenElements.addAll(
- inheritanceManager.lookupOverrides(element.enclosingElement, name));
- overriddenElements.addAll(
- inheritanceManager.lookupOverrides(element.enclosingElement, '$name='));
+ inheritanceManager.lookupOverrides(accessor.enclosingElement, name));
+ if (overriddenElements.isEmpty || !accessor.variable.isFinal) {
+ List<ExecutableElement> overriddenSetters = inheritanceManager
+ .lookupOverrides(accessor.enclosingElement, '$name=');
+ overriddenElements.addAll(overriddenSetters);
+ }
bool isCovariant = false;
DartType impliedType;
for (ExecutableElement overriddenElement in overriddenElements) {
FunctionType overriddenType =
- _toOverriddenFunctionType(element, overriddenElement);
+ _toOverriddenFunctionType(accessor, overriddenElement);
if (overriddenType == null) {
return new _FieldOverrideInferenceResult(false, null, true);
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | pkg/analyzer/test/src/summary/top_level_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698