• littledan's avatar
    Fix priority of exceptions being thrown from for-of loops · 5f67e34a
    littledan authored
    In the for-of desugaring, IteratorClose is a subtle thing to get right.
    When return exists, the logic for which exception to throw is as follows:
    1. Get the 'return' property and property any exception that might come from
      the property read
    2. Call return, not yet propagating an exception if it's thrown.
    3. If we are closing the iterator due to an exception, propagate that error.
    4. If return threw, propagate that error.
    5. Check if return's return value was not an object, and throw if so
    
    Previously, we were effectively doing step 5 even if an exception "had already
    been thrown" by step 3. Because this took place in a finally block, the exception
    "won the race" and was the one propagated to the user. The fix is a simple change
    to the desugaring to do step 5 only if step 3 didn't happen.
    
    R=rossberg
    BUG=v8:4775
    LOG=Y
    
    Review URL: https://codereview.chromium.org/1728973002
    
    Cr-Commit-Position: refs/heads/master@{#34261}
    5f67e34a
Name
Last commit
Last update
benchmarks Loading commit data...
build Loading commit data...
docs Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party/binutils Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.gitignore Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
Makefile Loading commit data...
Makefile.android Loading commit data...
Makefile.nacl Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...