Index: test/mjsunit/strong/function-arity.js |
diff --git a/test/mjsunit/strong/function-arity.js b/test/mjsunit/strong/function-arity.js |
index 4d8833564cc3dbe3d0de6968acd497959ed8d22c..71ea68cafda120debdeb7bf1f0f2789879852b28 100644 |
--- a/test/mjsunit/strong/function-arity.js |
+++ b/test/mjsunit/strong/function-arity.js |
@@ -21,7 +21,7 @@ function generateArguments(n, prefix) { |
} |
-function generateParams(n) { |
+function generateParams(n, directive_in_body) { |
let a = []; |
for (let i = 0; i < n; i++) { |
a[i] = `p${i}`; |
@@ -29,13 +29,17 @@ function generateParams(n) { |
return a.join(', '); |
} |
-function generateParamsWithRest(n) { |
+function generateParamsWithRest(n, directive_in_body) { |
let a = []; |
let i = 0; |
for (; i < n; i++) { |
a[i] = `p${i}`; |
} |
- a.push(`...p${i}`) |
+ if (!directive_in_body) { |
+ // If language mode directive occurs in body, rest parameters will trigger |
+ // an early error regardless of language mode. |
+ a.push(`...p${i}`); |
+ } |
return a.join(', '); |
} |
@@ -106,13 +110,13 @@ function generateSpread(n) { |
for (let parameterCount = 0; parameterCount < 3; parameterCount++) { |
let defs = [ |
`let o = new class { |
- m(${genParams(parameterCount)}) { 'use strong'; } |
+ m(${genParams(parameterCount, true)}) { 'use strong'; } |
}`, |
`let o = new class { |
- *m(${genParams(parameterCount)}) { 'use strong'; } |
+ *m(${genParams(parameterCount, true)}) { 'use strong'; } |
}`, |
- `let o = { m(${genParams(parameterCount)}) { 'use strong'; } }`, |
- `let o = { *m(${genParams(parameterCount)}) { 'use strong'; } }`, |
+ `let o = { m(${genParams(parameterCount, true)}) { 'use strong'; } }`, |
+ `let o = { *m(${genParams(parameterCount, true)}) { 'use strong'; } }`, |
`'use strong'; |
let o = new class { m(${genParams(parameterCount)}) {} }`, |
`'use strong'; |
@@ -173,7 +177,7 @@ function generateSpread(n) { |
class C { constructor(${genParams(parameterCount)}) {} }`, |
`'use strict'; |
class C { |
- constructor(${genParams(parameterCount)}) { 'use strong'; } |
+ constructor(${genParams(parameterCount, true)}) { 'use strong'; } |
}`, |
]; |
for (let def of defs) { |
@@ -214,7 +218,7 @@ function generateSpread(n) { |
}`, |
`'use strict'; |
class B { |
- constructor(${genParams(parameterCount)}) { 'use strong'; } |
+ constructor(${genParams(parameterCount, true)}) { 'use strong'; } |
} |
class C extends B { |
constructor() { |
@@ -250,7 +254,7 @@ function generateSpread(n) { |
class C extends B {}`, |
`'use strict'; |
class B { |
- constructor(${genParams(parameterCount)}) { 'use strong'; } |
+ constructor(${genParams(parameterCount, true)}) { 'use strong'; } |
} |
class C extends B {}`, |
]; |