• Adam Klein's avatar
    [parser] Stop treating generators as "top level" for preparsing purposes · 0439100a
    Adam Klein authored
    Generators were previously treated as "top level" for preparsing purposes,
    since all their variables are context-allocated. But doing so isn't quite
    correct: the allocation of the "arguments" variable for a generator
    depends on whether it's referenced, and so an inner arrow function
    which references "arguments" won't properly trigger allocation of
    "arguments" since the reference will not be noticed in the preparser.
    
    The same problem exists for "this" since commit 68f0a47b;
    before that commit, all generators implicitly referenced their "this" argument
    as part of the desugaring. With that implicit reference gone, "this"
    falls into the same problem as arguments.
    
    This patch restricts the special "top level" treatment to modules,
    which have only a trivial "this" binding (it's always undefined), and no
    arguments binding. Moreover, all code inside modules is strict, meaning
    that unresolved references to "this" will also result in undefined.
    
    R=marja@chromium.org
    
    Bug: chromium:723132
    Change-Id: I814d145fb8f3f1a65abb48e4e35595428d063051
    Reviewed-on: https://chromium-review.googlesource.com/508055Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
    Commit-Queue: Adam Klein <adamk@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#45399}
    0439100a
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
docs Loading commit data...
gni Loading commit data...
gypfiles 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 Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
DEPS.chromium Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm 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...
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...