mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:44:27 +00:00
[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:
parent
d3233115c8
commit
72f1c288bc
1 changed files with 6 additions and 0 deletions
|
@ -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 &&
|
||||
|
|
Loading…
Reference in a new issue