[parser] Stop treating generators as "top level" for preparsing purposes
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: Marja Hölttä <marja@chromium.org> Commit-Queue: Adam Klein <adamk@chromium.org> Cr-Commit-Position: refs/heads/master@{#45399}
Showing
Please
register
or
sign in
to comment