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