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

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

Issue 2944933002: Implement type inference for null-aware property gets. (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/frontend_accessors.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
index bb30957660032322d2fb0cd1dd6b4ae16921c054..a894a3a6a3fec3630720b5f18b039607ee724982 100644
--- a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
@@ -11,6 +11,7 @@ import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'
KernelComplexAssignment,
KernelConditionalExpression,
KernelMethodInvocation,
+ KernelNullAwarePropertyGet,
KernelPropertyAssign,
KernelPropertyGet,
KernelThisExpression,
@@ -345,19 +346,22 @@ class NullAwarePropertyAccessor extends Accessor {
Expression _finish(
Expression body, KernelComplexAssignment complexAssignment) {
- var nullAwareGuard = new KernelConditionalExpression(
- buildIsNull(receiverAccess(), offsetForToken(token)),
+ var offset = offsetForToken(token);
+ var nullAwareGuard = new ConditionalExpression(
+ buildIsNull(receiverAccess(), offset),
new NullLiteral(),
- body)
- ..fileOffset = offsetForToken(token);
- body = makeLet(receiver, nullAwareGuard);
+ body,
+ const DynamicType())
+ ..fileOffset = offset;
if (complexAssignment != null) {
+ body = makeLet(receiver, nullAwareGuard);
KernelPropertyAssign kernelPropertyAssign = complexAssignment;
kernelPropertyAssign.nullAwareGuard = nullAwareGuard;
kernelPropertyAssign.desugared = body;
return kernelPropertyAssign;
} else {
- return body;
+ return new KernelNullAwarePropertyGet(receiver, nullAwareGuard)
+ ..fileOffset = offset;
}
}
}

Powered by Google App Engine
This is Rietveld 408576698