| Index: test/cctest/test-parsing.cc
|
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
|
| index f9d210c7ae10f99f4b9daedbec694ba571c8e577..faa99b5e36f09766c01307c6b82f7a03c9873abe 100644
|
| --- a/test/cctest/test-parsing.cc
|
| +++ b/test/cctest/test-parsing.cc
|
| @@ -6818,3 +6818,77 @@ TEST(LetSloppy) {
|
| RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
|
| arraysize(always_flags));
|
| }
|
| +
|
| +
|
| +TEST(LanguageModeDirectivesNonSimpleParameterListErrors) {
|
| + // A block declaration scope as a child scope of a function scope
|
| + // indicates that a function has a non-simple parameter list.
|
| + // TC39 deemed "use strict" directives to be an error in this case,
|
| + // on 29/7/2015. https://goo.gl/ueA7Ln
|
| + //
|
| + // In V8, this also applies to "use strong " directives.
|
| + const char* context_data[][2] = {
|
| + /*
|
| + var a = ({ bindingPattern = {} }) => { 'use strict'; }
|
| + */
|
| +
|
| + {"function f(", ") { 'use strict'; }"},
|
| + {"function f(", ") { 'use strong'; }"},
|
| + {"function* g(", ") { 'use strict'; }"},
|
| + {"function* g(", ") { 'use strong'; }"},
|
| + {"var a = (", ") => { 'use strict'; }"},
|
| + {"var a = (", ") => { 'use strong'; }"},
|
| + {"var o = { m(", ") { 'use strict'; }"},
|
| + {"var o = { m(", ") { 'use strong'; }"},
|
| + {"var o = { *gm(", ") { 'use strict'; }"},
|
| + {"var o = { *gm(", ") { 'use strong'; }"},
|
| + {"var c = { m(", ") { 'use strict'; }"},
|
| + {"var c = { m(", ") { 'use strong'; }"},
|
| + {"var c = { *gm(", ") { 'use strict'; }"},
|
| + {"var c = { *gm(", ") { 'use strong'; }"},
|
| +
|
| + {"'use strict'; function f(", ") { 'use strict'; }"},
|
| + {"'use strict'; function f(", ") { 'use strong'; }"},
|
| + {"'use strict'; function* g(", ") { 'use strict'; }"},
|
| + {"'use strict'; function* g(", ") { 'use strong'; }"},
|
| + {"'use strict'; var a = (", ") => { 'use strict'; }"},
|
| + {"'use strict'; var a = (", ") => { 'use strong'; }"},
|
| + {"'use strict'; var o = { m(", ") { 'use strict'; }"},
|
| + {"'use strict'; var o = { m(", ") { 'use strong'; }"},
|
| + {"'use strict'; var o = { *gm(", ") { 'use strict'; }"},
|
| + {"'use strict'; var o = { *gm(", ") { 'use strong'; }"},
|
| + {"'use strict'; var c = { m(", ") { 'use strict'; }"},
|
| + {"'use strict'; var c = { m(", ") { 'use strong'; }"},
|
| + {"'use strict'; var c = { *gm(", ") { 'use strict'; }"},
|
| + {"'use strict'; var c = { *gm(", ") { 'use strong'; }"},
|
| +
|
| + {"'use strong'; function f(", ") { 'use strict'; }"},
|
| + {"'use strong'; function f(", ") { 'use strong'; }"},
|
| + {"'use strong'; function* g(", ") { 'use strict'; }"},
|
| + {"'use strong'; function* g(", ") { 'use strong'; }"},
|
| + {"'use strong'; var a = (", ") => { 'use strict'; }"},
|
| + {"'use strong'; var a = (", ") => { 'use strong'; }"},
|
| + {"'use strong'; var o = { m(", ") { 'use strict'; }"},
|
| + {"'use strong'; var o = { m(", ") { 'use strong'; }"},
|
| + {"'use strong'; var o = { *gm(", ") { 'use strict'; }"},
|
| + {"'use strong'; var o = { *gm(", ") { 'use strong'; }"},
|
| + {"'use strong'; var c = { m(", ") { 'use strict'; }"},
|
| + {"'use strong'; var c = { m(", ") { 'use strong'; }"},
|
| + {"'use strong'; var c = { *gm(", ") { 'use strict'; }"},
|
| + {"'use strong'; var c = { *gm(", ") { 'use strong'; }"},
|
| + {NULL, NULL}};
|
| +
|
| + const char* data[] = {
|
| + // TODO(@caitp): support formal parameter initializers
|
| + "initializer = true"
|
| + "...rest",
|
| + "{ bindingPattern = {} }",
|
| + "{ initializedBindingPattern } = { initializedBindingPattern = true }",
|
| + NULL};
|
| +
|
| + static const ParserFlag always_flags[] = {
|
| + kAllowHarmonyArrowFunctions, kAllowHarmonyDestructuring,
|
| + kAllowHarmonyRestParameters, kAllowStrongMode};
|
| + RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
|
| + arraysize(always_flags));
|
| +}
|
|
|