Commit d22346de authored by Michaël Zasso's avatar Michaël Zasso
Browse files

deps: fix async await desugaring in V8

This is a backport of https://codereview.chromium.org/2672313003/. The
patch did not land in V8 because it was superseded by another one but it
is much easier to backport to V8 5.5, was reviewed and passed tests.

Original commit message:

    [async await] Fix async function desugaring

    Previously we rewrote the return statement in an async function from
    `return expr;` to `return %ResolvePromise(.promise, expr),
    .promise`. This can lead to incorrect behavior in the presence of try-finally.

    This patch stores the `expr` of the return statement in a temporary
    variable, resolves and returns the promise at the end of the finally
    block.

    BUG=v8:5896

PR-URL: https://github.com/nodejs/node/pull/12004
Fixes: https://github.com/nodejs/node/issues/11960


Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarBen Noordhuis <info@bnoordhuis.nl>
parent bc664cb0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment