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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart

Issue 2942153002: Enable top level inference of instance property gets/sets. (Closed)
Patch Set: Created 3 years, 6 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/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index aff3e6f5a52dfa1b4ee0df9ec0c6556b04470826..195fcfd596ab7d6bd08c84f49f3e8d12d98d27b8 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -1409,9 +1409,16 @@ class KernelPropertyAssign extends KernelComplexAssignmentWithReceiver {
((writeMember is Procedure &&
writeMember.kind == ProcedureKind.Setter) ||
writeMember is Field)) {
- // References to fields and setters can't be relied upon for top level
- // inference.
- inferrer.recordNotImmediatelyEvident(fileOffset);
+ if (TypeInferenceEngineImpl.fullTopLevelInference) {
+ if (writeMember is KernelField && writeMember._fieldNode != null) {
+ inferrer.engine
+ .inferFieldFused(writeMember._fieldNode, inferrer.fieldNode);
+ }
+ } else {
+ // References to fields and setters can't be relied upon for top level
+ // inference.
+ inferrer.recordNotImmediatelyEvident(fileOffset);
+ }
}
}
// To replicate analyzer behavior, we base type inference on the write
@@ -1465,9 +1472,17 @@ class KernelPropertyGet extends PropertyGet implements KernelExpression {
((interfaceMember is Procedure &&
interfaceMember.kind == ProcedureKind.Getter) ||
interfaceMember is Field)) {
- // References to fields and getters can't be relied upon for top level
- // inference.
- inferrer.recordNotImmediatelyEvident(fileOffset);
+ if (TypeInferenceEngineImpl.fullTopLevelInference) {
+ if (interfaceMember is KernelField &&
+ interfaceMember._fieldNode != null) {
+ inferrer.engine
+ .inferFieldFused(interfaceMember._fieldNode, inferrer.fieldNode);
+ }
+ } else {
+ // References to fields and getters can't be relied upon for top level
+ // inference.
+ inferrer.recordNotImmediatelyEvident(fileOffset);
+ }
}
interfaceTarget = interfaceMember;
var inferredType =

Powered by Google App Engine
This is Rietveld 408576698