Debian Codegraph @

js/src/tests/test262/language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js

raw
1 // |reftest| error:SyntaxError
2 // Copyright (C) 2015 Mozilla Corporation. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 author: Jeff Walden
7 es6id: 13.3.1.1
8 description: >
9 let: |let let| split across two lines is not subject to automatic semicolon insertion.
10 info: |
11 |let| followed by a name is a lexical declaration. This is so even if the
12 name is on a new line. ASI applies *only* if an offending token not allowed
13 by the grammar is encountered, and there's no [no LineTerminator here]
14 restriction in LexicalDeclaration or ForDeclaration forbidding a line break.
15
16 It's a tricky point, but this is true *even if* the name is "let", a name that
17 can't be bound by LexicalDeclaration or ForDeclaration. Per 5.3, static
18 semantics early errors are validated *after* determining productions matching
19 the source text.
20
21 So in this testcase, the eval text matches LexicalDeclaration. No ASI occurs,
22 because "let\nlet = ..." matches LexicalDeclaration before static semantics
23 are considered. *Then* 13.3.1.1's static semantics for the LexicalDeclaration
24 just chosen, per 5.3, are validated to recognize the Script as invalid. Thus
25 the eval script can't be evaluated, and a SyntaxError is thrown.
26 negative:
27 phase: parse
28 type: SyntaxError
29 ---*/
30
31 $DONOTEVALUATE();
32
33 let // start of a LexicalDeclaration, *not* an ASI opportunity
34 let = "irrelevant initializer";