From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../test262/language/statements/continue/12.7-1.js | 20 ++++++++++ .../language/statements/continue/S12.7_A1_T1.js | 24 +++++++++++ .../language/statements/continue/S12.7_A1_T2.js | 26 ++++++++++++ .../language/statements/continue/S12.7_A1_T3.js | 28 +++++++++++++ .../language/statements/continue/S12.7_A1_T4.js | 26 ++++++++++++ .../language/statements/continue/S12.7_A5_T1.js | 32 +++++++++++++++ .../language/statements/continue/S12.7_A5_T2.js | 32 +++++++++++++++ .../language/statements/continue/S12.7_A5_T3.js | 33 ++++++++++++++++ .../language/statements/continue/S12.7_A6.js | 24 +++++++++++ .../language/statements/continue/S12.7_A7.js | 31 +++++++++++++++ .../language/statements/continue/S12.7_A8_T1.js | 23 +++++++++++ .../language/statements/continue/S12.7_A8_T2.js | 19 +++++++++ .../language/statements/continue/S12.7_A9_T1.js | 34 ++++++++++++++++ .../language/statements/continue/S12.7_A9_T2.js | 32 +++++++++++++++ .../language/statements/continue/browser.js | 0 .../statements/continue/labeled-continue.js | 18 +++++++++ .../statements/continue/line-terminators.js | 46 ++++++++++++++++++++++ .../nested-let-bound-for-loops-inner-continue.js | 19 +++++++++ .../nested-let-bound-for-loops-labeled-continue.js | 19 +++++++++ .../nested-let-bound-for-loops-outer-continue.js | 19 +++++++++ .../statements/continue/no-label-continue.js | 17 ++++++++ ...wing-loop-variable-in-same-scope-as-continue.js | 19 +++++++++ .../test262/language/statements/continue/shell.js | 0 .../statements/continue/simple-and-labeled.js | 17 ++++++++ .../statements/continue/static-init-with-label.js | 29 ++++++++++++++ .../continue/static-init-without-label.js | 29 ++++++++++++++ 26 files changed, 616 insertions(+) create mode 100644 js/src/tests/test262/language/statements/continue/12.7-1.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A1_T1.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A1_T2.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A1_T3.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A1_T4.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A5_T1.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A5_T2.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A5_T3.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A6.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A7.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A8_T1.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A8_T2.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A9_T1.js create mode 100644 js/src/tests/test262/language/statements/continue/S12.7_A9_T2.js create mode 100644 js/src/tests/test262/language/statements/continue/browser.js create mode 100644 js/src/tests/test262/language/statements/continue/labeled-continue.js create mode 100644 js/src/tests/test262/language/statements/continue/line-terminators.js create mode 100644 js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-inner-continue.js create mode 100644 js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-labeled-continue.js create mode 100644 js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-outer-continue.js create mode 100644 js/src/tests/test262/language/statements/continue/no-label-continue.js create mode 100644 js/src/tests/test262/language/statements/continue/shadowing-loop-variable-in-same-scope-as-continue.js create mode 100644 js/src/tests/test262/language/statements/continue/shell.js create mode 100644 js/src/tests/test262/language/statements/continue/simple-and-labeled.js create mode 100644 js/src/tests/test262/language/statements/continue/static-init-with-label.js create mode 100644 js/src/tests/test262/language/statements/continue/static-init-without-label.js (limited to 'js/src/tests/test262/language/statements/continue') diff --git a/js/src/tests/test262/language/statements/continue/12.7-1.js b/js/src/tests/test262/language/statements/continue/12.7-1.js new file mode 100644 index 0000000000..ea88550833 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/12.7-1.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.7-1 +description: > + The continue Statement - a continue statement without an + identifier may have a LineTerminator before the semi-colon +---*/ + +var sum = 0; +for (var i = 1; i <= 10; i++) { + if (true) continue + ; else {} + sum += i; +} + +assert.sameValue(sum, 0, 'sum'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A1_T1.js b/js/src/tests/test262/language/statements/continue/S12.7_A1_T1.js new file mode 100644 index 0000000000..1d042a048c --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A1_T1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Appearing of continue without an IterationStatement leads to syntax error +es5id: 12.7_A1_T1 +description: > + Checking if execution of single "continue" without any + IterationStatement fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +continue; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A1_T2.js b/js/src/tests/test262/language/statements/continue/S12.7_A1_T2.js new file mode 100644 index 0000000000..6212c359a0 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A1_T2.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Appearing of continue without an IterationStatement leads to syntax error +es5id: 12.7_A1_T2 +description: > + Checking if single "continue" with Label but without any + IterationStatement fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +continue LABEL; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A1_T3.js b/js/src/tests/test262/language/statements/continue/S12.7_A1_T3.js new file mode 100644 index 0000000000..2a3b03a664 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A1_T3.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Appearing of continue without an IterationStatement leads to syntax error +es5id: 12.7_A1_T3 +description: > + Checking if laballed "continue" with no IterationStatement, placed + into a block, fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + continue LABEL; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A1_T4.js b/js/src/tests/test262/language/statements/continue/S12.7_A1_T4.js new file mode 100644 index 0000000000..140ace8ff7 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A1_T4.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Appearing of continue without an IterationStatement leads to syntax error +es5id: 12.7_A1_T4 +description: > + Checking if execution of "continue" with no IterationStatement, + placed into a block, fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + continue; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A5_T1.js b/js/src/tests/test262/language/statements/continue/S12.7_A5_T1.js new file mode 100644 index 0000000000..467801e7bf --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A5_T1.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When "continue Identifier" is evaluated Identifier must be label in the + label set of an enclosing (but not crossing function boundaries) + IterationStatement +es5id: 12.7_A5_T1 +description: Trying to continue another labeled loop +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +LABEL_OUT : var x=0, y=0; +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue LABEL_ANOTHER_LOOP; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A5_T2.js b/js/src/tests/test262/language/statements/continue/S12.7_A5_T2.js new file mode 100644 index 0000000000..2a189f9fe6 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A5_T2.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When "continue Identifier" is evaluated Identifier must be label in the + label set of an enclosing (but not crossing function boundaries) + IterationStatement +es5id: 12.7_A5_T2 +description: Identifier is a function name +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +LABEL_OUT : var x=0, y=0; +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue IN_DO_FUNC; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){}; diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A5_T3.js b/js/src/tests/test262/language/statements/continue/S12.7_A5_T3.js new file mode 100644 index 0000000000..ab3d4eeed6 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A5_T3.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When "continue Identifier" is evaluated Identifier must be label in the + label set of an enclosing (but not crossing function boundaries) + IterationStatement +es5id: 12.7_A5_T3 +description: Identifier is within loop label +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +LABEL_OUT : var x=0, y=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue LABEL_IN; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A6.js b/js/src/tests/test262/language/statements/continue/S12.7_A6.js new file mode 100644 index 0000000000..c9991d1f1e --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A6.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Appearing of "continue" within a function call that is within an + IterationStatement yields SyntaxError +es5id: 12.7_A6 +description: Using labaled "continue Identifier" within a function body +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var x=0,y=0; + +LABEL1 : do { + x++; + (function(){continue LABEL1;})(); + y++; +} while(0); diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A7.js b/js/src/tests/test262/language/statements/continue/S12.7_A7.js new file mode 100644 index 0000000000..c0670718bf --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A7.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Appearing of continue within eval statement that is within an + IterationStatement yields SyntaxError +es5id: 12.7_A7 +description: Using eval "eval("continue LABEL1")" +---*/ + +var x=0,y=0; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + LABEL1 : do { + x++; + eval("continue LABEL1"); + y++; + } while(0); + throw new Test262Error('#1: eval("continue LABEL1") does not lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + throw new Test262Error("1.1: Appearing of continue within eval statement inside of IterationStatement yields SyntaxError"); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A8_T1.js b/js/src/tests/test262/language/statements/continue/S12.7_A8_T1.js new file mode 100644 index 0000000000..74f72b2182 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A8_T1.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Appearing of "continue" within a "try/catch" Block yields SyntaxError +es5id: 12.7_A8_T1 +description: > + Checking if execution of "continue Identifier" within catch Block + fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +try{ +} catch(e){ + continue LABEL2; + LABEL2 : do { + } while(0); +}; diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A8_T2.js b/js/src/tests/test262/language/statements/continue/S12.7_A8_T2.js new file mode 100644 index 0000000000..474a118776 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A8_T2.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Appearing of "continue" within a "try/catch" Block yields SyntaxError +es5id: 12.7_A8_T2 +description: Checking if execution of "continue" within catch Block fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +try{ +} catch(e){ + continue; +}; diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A9_T1.js b/js/src/tests/test262/language/statements/continue/S12.7_A9_T1.js new file mode 100644 index 0000000000..7672328da5 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A9_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Continue inside of try-catch nested in a loop is allowed +es5id: 12.7_A9_T1 +description: > + Using "continue Identifier" within catch Block that is within a + loop +---*/ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + continue FOR; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==10) { + throw new Test262Error('#1: Continue inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A9_T2.js b/js/src/tests/test262/language/statements/continue/S12.7_A9_T2.js new file mode 100644 index 0000000000..8a447aeb2d --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/S12.7_A9_T2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Continue inside of try-catch nested in a loop is allowed +es5id: 12.7_A9_T2 +description: Using "continue" within catch Block that is within a loop +---*/ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + continue; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==10) { + throw new Test262Error('#1: Continue inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/browser.js b/js/src/tests/test262/language/statements/continue/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/statements/continue/labeled-continue.js b/js/src/tests/test262/language/statements/continue/labeled-continue.js new file mode 100644 index 0000000000..3925c189e6 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/labeled-continue.js @@ -0,0 +1,18 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.12 +description: > + labeled continue +---*/ +var count = 0; +label: for (let x = 0; x < 10;) { + while (true) { + x++; + count++; + continue label; + } +} +assert.sameValue(count, 10, "The value of `count` is `10`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/line-terminators.js b/js/src/tests/test262/language/statements/continue/line-terminators.js new file mode 100644 index 0000000000..6790dfc859 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/line-terminators.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Since LineTerminator between "continue" and Identifier is not allowed, + "continue" is evaluated without label +es5id: 12.7_A2 +description: > + Checking by using eval, inserting LineTerminator between continue + and Identifier +---*/ + +FOR1 : for(var i=1;i<2;i++){ + FOR1NESTED : for(var j=1;j<2;j++) { + continue +FOR1; + } while(0); +} + +assert.sameValue(j, 2, '#1: Since LineTerminator(U-000A) between continue and Identifier not allowed continue evaluates without label'); + +FOR2 : for(var i=1;i<2;i++){ + FOR2NESTED : for(var j=1;j<2;j++) { + continue FOR2; + } while(0); +} + +assert.sameValue(j, 2, '#2: Since LineTerminator(U-000D) between continue and Identifier not allowed continue evaluates without label'); + +FOR3 : for(var i=1;i<2;i++){ + FOR3NESTED : for(var j=1;j<2;j++) { + continue
FOR3; + } while(0); +} +assert.sameValue(j, 2, '#3: Since LineTerminator(U-2028) between continue and Identifier not allowed continue evaluates without label'); + +FOR4 : for(var i=1;i<2;i++){ + FOR4NESTED : for(var j=1;j<2;j++) { + continue
FOR4; + } while(0); +} + +assert.sameValue(j, 2, '#4: Since LineTerminator(U-2029) between continue and Identifier not allowed continue evaluates without label'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-inner-continue.js b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-inner-continue.js new file mode 100644 index 0000000000..be9d804e46 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-inner-continue.js @@ -0,0 +1,19 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.12 +description: > + nested let bound for loops inner continue +---*/ +var count = 0; +for (let x = 0; x < 10;) { + x++; + for (let y = 0; y < 2;) { + y++; + count++; + continue; + } +} +assert.sameValue(count, 20, "The value of `count` is `20`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-labeled-continue.js b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-labeled-continue.js new file mode 100644 index 0000000000..7d7942b100 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-labeled-continue.js @@ -0,0 +1,19 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.12 +description: > + nested let bound for loops labeled continue +---*/ +var count = 0; +outer: for (let x = 0; x < 10;) { + x++; + for (let y = 0; y < 2;) { + y++; + count++; + if (y == 2) continue outer; + } +} +assert.sameValue(count, 20, "The value of `count` is `20`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-outer-continue.js b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-outer-continue.js new file mode 100644 index 0000000000..9319624961 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-outer-continue.js @@ -0,0 +1,19 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.12 +description: > + nested let bound for loops outer continue +---*/ +var count = 0; +for (let x = 0; x < 10;) { + x++; + for (let y = 0; y < 2;) { + y++; + count++; + } + continue; +} +assert.sameValue(count, 20, "The value of `count` is `20`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/no-label-continue.js b/js/src/tests/test262/language/statements/continue/no-label-continue.js new file mode 100644 index 0000000000..f05b38861a --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/no-label-continue.js @@ -0,0 +1,17 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.12 +description: > + no label continue +---*/ +var count = 0; +for (let x = 0; x < 10;) { + x++; + count++; + continue; +} +assert.sameValue(count, 10, "The value of `count` is `10`"); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/shadowing-loop-variable-in-same-scope-as-continue.js b/js/src/tests/test262/language/statements/continue/shadowing-loop-variable-in-same-scope-as-continue.js new file mode 100644 index 0000000000..a216e1487e --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/shadowing-loop-variable-in-same-scope-as-continue.js @@ -0,0 +1,19 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.12 +description: > + shadowing loop variable in same scope as continue +---*/ +var count = 0; +for (let x = 0; x < 10;) { + x++; + count++; + { + let x = "hello"; + continue; + } +} +assert.sameValue(count, 10, "The value of `count` is `10`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/shell.js b/js/src/tests/test262/language/statements/continue/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/statements/continue/simple-and-labeled.js b/js/src/tests/test262/language/statements/continue/simple-and-labeled.js new file mode 100644 index 0000000000..c372dfb5c9 --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/simple-and-labeled.js @@ -0,0 +1,17 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.12 +description: > + basic labeled for loop with continue +---*/ +var count = 0; +label: for (let x = 0; x < 10;) { + x++; + count++; + continue label; +} +assert.sameValue(count, 10, "The value of `count` is `10`"); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/continue/static-init-with-label.js b/js/src/tests/test262/language/statements/continue/static-init-with-label.js new file mode 100644 index 0000000000..cb9d9b0c3d --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/static-init-with-label.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-continue-statement +description: IterationStatement search does not traverse static initialization block boundaries (label specified) +info: | + 4.1.1 Static Semantics: Early Errors + ContinueStatement : continue ; + ContinueStatement : continue LabelIdentifier ; + + - It is a Syntax Error if this ContinueStatement is not nested, directly or + indirectly (but not crossing function or static initialization block + boundaries), within an IterationStatement. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +label: while(false) { + class C { + static { + continue label; + } + } +} diff --git a/js/src/tests/test262/language/statements/continue/static-init-without-label.js b/js/src/tests/test262/language/statements/continue/static-init-without-label.js new file mode 100644 index 0000000000..9d4da1774a --- /dev/null +++ b/js/src/tests/test262/language/statements/continue/static-init-without-label.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-continue-statement +description: IterationStatement search does not traverse static initialization block boundaries (no label specified) +info: | + 4.1.1 Static Semantics: Early Errors + ContinueStatement : continue ; + ContinueStatement : continue LabelIdentifier ; + + - It is a Syntax Error if this ContinueStatement is not nested, directly or + indirectly (but not crossing function or static initialization block + boundaries), within an IterationStatement. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +label: while(false) { + class C { + static { + continue; + } + } +} -- cgit v1.2.3