Commit 3ee21f28 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[parser] Skipping inner funcs: params part 4

Add some tests which already pass.

BUG=v8:5516
R=vogelheim@chromium.org

Change-Id: Icf5cf5e40010deb2efb69dea750661854b055566
Reviewed-on: https://chromium-review.googlesource.com/444744
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarDaniel Vogelheim <vogelheim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43278}
parent b6bfe7b9
...@@ -357,12 +357,73 @@ TEST(PreParserScopeAnalysis) { ...@@ -357,12 +357,73 @@ TEST(PreParserScopeAnalysis) {
{"var1, ...var2", "function f1() { var2; }"}, {"var1, ...var2", "function f1() { var2; }"},
{"var1, ...var2", "function f1() { var2 = 9; }"}, {"var1, ...var2", "function f1() { var2 = 9; }"},
// FIXME(marja): destructuring parameters, default parameters, shadowing // Default parameters.
// parameters, default parameters referring to other parameters, arguments {"var1 = 3", ""},
// parameter, eval in default parameter, params and locals, multiple {"var1, var2 = var1", ""},
// params, destructuring rest, locals shadowing params, locals shadowing {"var1, var2 = 4, ...var3", ""},
// rest, locals shadowing destructuring params, shadowing by a hoisted
// sloppy block function. // Destructuring parameters. Because of the search space explosion, we
// cannot test all interesting cases. Let's try to test a relevant subset.
{"[]", ""},
{"{}", ""},
{"[var1]", ""},
{"{name1: var1}", ""},
{"{var1}", ""},
{"[var1]", "var1;"},
{"{name1: var1}", "var1;"},
{"{name1: var1}", "name1;"},
{"{var1}", "var1;"},
{"[var1]", "var1 = 16;"},
{"{name1: var1}", "var1 = 16;"},
{"{name1: var1}", "name1 = 16;"},
{"{var1}", "var1 = 16;"},
{"[var1]", "() => { var1; }"},
{"{name1: var1}", "() => { var1; }"},
{"{name1: var1}", "() => { name1; }"},
{"{var1}", "() => { var1; }"},
{"[var1, var2, var3]", ""},
{"{name1: var1, name2: var2, name3: var3}", ""},
{"{var1, var2, var3}", ""},
{"[var1, var2, var3]", "() => { var2 = 16;}"},
{"{name1: var1, name2: var2, name3: var3}", "() => { var2 = 16;}"},
{"{name1: var1, name2: var2, name3: var3}", "() => { name2 = 16;}"},
{"{var1, var2, var3}", "() => { var2 = 16;}"},
// Nesting destructuring.
{"[var1, [var2, var3], {var4, name5: [var5, var6]}]", ""},
// Complicated params.
{"var1, [var2], var3, [var4, var5], var6, {var7}, var8, {name9: var9, "
"name10: var10}, ...var11",
""},
// Destructuring rest. Because we can.
{"var1, ...[var2]", "() => { }"},
{"var1, ...[var2]", "() => { var2; }"},
// Default parameters for destruring parameters.
{"[var1 = 4, var2 = var1]", "", false},
{"{var1 = 4, var2 = var1}", "", false},
// Locals shadowing parameters.
{"var1, var2", "var var1 = 16; () => { var1 = 17; }"},
// Locals shadowing destructuring parameters and the rest parameter.
{"[var1, var2]", "var var1 = 16; () => { var1 = 17; }"},
{"{var1, var2}", "var var1 = 16; () => { var1 = 17; }"},
{"var1, var2, ...var3", "var var3 = 16; () => { var3 = 17; }"},
{"var1, var2 = var1", "var var1 = 16; () => { var1 = 17; }"},
// Hoisted sloppy block function shadowing a parameter.
{"var1, var2", "for (;;) { function var1() { } }"},
// FIXME(marja): Eval in default parameter.
}; };
for (unsigned outer_ix = 0; outer_ix < arraysize(outers); ++outer_ix) { for (unsigned outer_ix = 0; outer_ix < arraysize(outers); ++outer_ix) {
......
Markdown is supported
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