diff options
Diffstat (limited to 'deps/v8/test/mjsunit/harmony/class-static-blocks.js')
-rw-r--r-- | deps/v8/test/mjsunit/harmony/class-static-blocks.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/harmony/class-static-blocks.js b/deps/v8/test/mjsunit/harmony/class-static-blocks.js index b4bb710e68..0bfcd8804c 100644 --- a/deps/v8/test/mjsunit/harmony/class-static-blocks.js +++ b/deps/v8/test/mjsunit/harmony/class-static-blocks.js @@ -113,6 +113,19 @@ assertArrayEquals([undefined], log); } +{ + // 'await' is allowed as an identifier name in named function expressions. + class C1 { static { (function await() {}); } } + // 'return' is allowed across function boundaries inside static blocks. + class C2 { static { + function f1() { return; } + function f2() { return 0; } + let f3 = (x => { return x; }) + let f4 = (x => { return; }) + } + } +} + function assertDoesntParse(expr, context_start, context_end) { assertThrows(() => { eval(`${context_start} class C { static { ${expr} } } ${context_end}`); @@ -131,4 +144,14 @@ for (let [s, e] of [['', ''], // 'await' is disallowed as an identifier. assertDoesntParse('let await;', s, e); assertDoesntParse('await;', s, e); + assertDoesntParse('function await() {}', s, e); + assertDoesntParse('class await() {}', s, e); + assertDoesntParse('try {} catch (await) {}', s, e); + assertDoesntParse('try {} catch ({await}) {}', s, e); + assertDoesntParse('var {await} = 0;', s, e); + assertDoesntParse('({await} = 0);', s, e); + assertDoesntParse('return;', s, e); + assertDoesntParse('return 0;', s, e); + assertDoesntParse('{ return; }', s, e); + assertDoesntParse('{ return 0; }', s, e); } |