• Marja Hölttä's avatar
    [parser|cleanup] Add tests for duplicate parameters. · ab4233e3
    Marja Hölttä authored
    There are at least 3 mechanisms for detecting duplicate parameters.
    - ExpressionClassifier
    - Scope::DeclareParameter checking IsDeclaredParameter
    - PatternRewriter::VisitVariableProxy failing to declare a duplicate parameter
    
    The conditions for when duplicate parameters are allowed and when not are pretty
    involved too. They are allowed when
    - the function is not an arrow function and not a concise method *and*
    - when the parameter list is simple *and*
    - we're in sloppy mode (incl. the function doesn't declare itself strict).
    
    In addition, we don't recognize some of the early errors, and it's 
    non-trivial to see which ones are recognized and which not (see bug
    v8:6108). E.g., (dup, dup) => {}; is recognized but (dup, [dup]) => {} is
    not. And (dup, [dup]) => 1; is.
    
    We do have tests for some aspects of duplicate parameters (e.g., arrow function
    duplicate parameters are included in arrow function tests), but it's hard to see
    whether all combinations of the relevant conditions are tested.
    
    This CL adds more structured tests which hopefully enables reducing the
    duplicate parameter detection mechanisms to 2 or maybe even to 1.
    
    BUG=v8:6092
    
    Change-Id: Idd3db43b380aae4b9a89be5f1ed0755d39bfb36d
    Reviewed-on: https://chromium-review.googlesource.com/456336
    Commit-Queue: Marja Hölttä <marja@chromium.org>
    Reviewed-by: 's avatarDaniel Vogelheim <vogelheim@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#43895}
    ab4233e3
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...
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...