Debian Codegraph @

js/src/tests/test262/language/asi/do-while-same-line.js

raw
1 // Copyright (C) 2019 Leo Balter. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-rules-of-automatic-semicolon-insertion
6 description: ASI at the end of a do-while statement without a new line terminator
7 info: |
8 1. When, as the source text is parsed from left to right, a token (called the offending token) is
9 encountered that is not allowed by any production of the grammar, then a semicolon is
10 automatically inserted before the offending token if one or more of the following conditions is
11 true:
12
13 ...
14 - The previous token is ) and the inserted semicolon would then be parsed as the terminating
15 semicolon of a do-while statement (13.7.2).
16 ---*/
17
18 var x;
19 do break ; while (0) x = 42;
20 assert.sameValue(x, 42);
21
22 x = 0;
23 do do do ; while (x) while (x) while (x) x = 39;
24 assert.sameValue(x, 39);
25
26 reportCompare(0, 0);