(this: Parser, node: Undone<N.ReturnStatement>)
| 971 | } |
| 972 | |
| 973 | parseReturnStatement(this: Parser, node: Undone<N.ReturnStatement>) { |
| 974 | if (!this.prodParam.hasReturn) { |
| 975 | this.raise(Errors.IllegalReturn, this.state.startLoc); |
| 976 | } |
| 977 | |
| 978 | this.next(); |
| 979 | |
| 980 | // In `return` (and `break`/`continue`), the keywords with |
| 981 | // optional arguments, we eagerly look for a semicolon or the |
| 982 | // possibility to insert one. |
| 983 | |
| 984 | if (this.isLineTerminator()) { |
| 985 | node.argument = null; |
| 986 | } else { |
| 987 | node.argument = this.parseExpression(); |
| 988 | this.semicolon(); |
| 989 | } |
| 990 | |
| 991 | return this.finishNode(node, "ReturnStatement"); |
| 992 | } |
| 993 | |
| 994 | // https://tc39.es/ecma262/#prod-SwitchStatement |
| 995 | parseSwitchStatement(this: Parser, node: Undone<N.SwitchStatement>) { |
nothing calls this directly
no test coverage detected