()
| 2374 | // https://tc39.github.io/ecma262/#sec-break-statement |
| 2375 | |
| 2376 | parseBreakStatement(): Node.BreakStatement { |
| 2377 | const node = this.createNode(); |
| 2378 | this.expectKeyword('break'); |
| 2379 | |
| 2380 | let label: Node.Identifier | null = null; |
| 2381 | if (this.lookahead.type === Token.Identifier && !this.hasLineTerminator) { |
| 2382 | const id = this.parseVariableIdentifier(); |
| 2383 | |
| 2384 | const key = '$' + id.name; |
| 2385 | if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { |
| 2386 | this.throwError(Messages.UnknownLabel, id.name); |
| 2387 | } |
| 2388 | label = id; |
| 2389 | } |
| 2390 | |
| 2391 | this.consumeSemicolon(); |
| 2392 | if (label === null && !this.context.inIteration && !this.context.inSwitch) { |
| 2393 | this.throwError(Messages.IllegalBreak); |
| 2394 | } |
| 2395 | |
| 2396 | return this.finalize(node, new Node.BreakStatement(label)); |
| 2397 | } |
| 2398 | |
| 2399 | // https://tc39.github.io/ecma262/#sec-return-statement |
| 2400 |
no test coverage detected