[dart2js] Bailout tracing when hitting return values of async members.

When tracing closures, we accidentally ignored the fact that returning from a non-async
function allows the value to flow in other ways (e.g. through the completion of a future).

This changes the node tracer to always consider the async marker when looking at values
that flow into 'MemberInformation' information nodes, which are the nodes we use
to represent the returned value of a method.

Fixes #52825

Change-Id: I3322e105dc9612f47a516a17f9465bf1002a9f87
Fixed: 52825
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312708
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
This commit is contained in:
Sigmund Cherem 2023-07-14 00:24:07 +00:00 committed by Commit Queue
parent d3233115c8
commit 72f1c288bc

View file

@ -564,6 +564,9 @@ abstract class TracerVisitor implements TypeInformationVisitor {
return cls != null && cls.isClosure;
}
bool isAsync(MemberEntity element) =>
element is FunctionEntity && element.asyncMarker == AsyncMarker.ASYNC;
@override
void visitMemberTypeInformation(MemberTypeInformation info) {
if (info.isClosurized) {
@ -572,6 +575,9 @@ abstract class TracerVisitor implements TypeInformationVisitor {
if (isClosure(info.member)) {
bailout('Returned from a closure');
}
if (isAsync(info.member)) {
bailout('Returned from an async method');
}
final member = info.member;
if (member is FieldEntity &&