(
this: Parser,
node: Undone<N.TryStatement>,
)
| 1072 | } |
| 1073 | |
| 1074 | parseTryStatement( |
| 1075 | this: Parser, |
| 1076 | node: Undone<N.TryStatement>, |
| 1077 | ): N.TryStatement { |
| 1078 | this.next(); |
| 1079 | |
| 1080 | node.block = this.parseBlock(); |
| 1081 | node.handler = null; |
| 1082 | |
| 1083 | if (this.match(tt._catch)) { |
| 1084 | const clause = this.startNode<N.CatchClause>(); |
| 1085 | this.next(); |
| 1086 | if (this.match(tt.parenL)) { |
| 1087 | this.expect(tt.parenL); |
| 1088 | clause.param = this.parseCatchClauseParam(); |
| 1089 | this.expect(tt.parenR); |
| 1090 | } else { |
| 1091 | clause.param = null; |
| 1092 | this.scope.enter(ScopeFlag.OTHER); |
| 1093 | } |
| 1094 | |
| 1095 | // Parse the catch clause's body. |
| 1096 | clause.body = this.parseBlock(false, false); |
| 1097 | |
| 1098 | this.scope.exit(); |
| 1099 | node.handler = this.finishNode(clause, "CatchClause"); |
| 1100 | } |
| 1101 | |
| 1102 | node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null; |
| 1103 | |
| 1104 | if (!node.handler && !node.finalizer) { |
| 1105 | this.raise(Errors.NoCatchOrFinally, node); |
| 1106 | } |
| 1107 | |
| 1108 | return this.finishNode(node, "TryStatement"); |
| 1109 | } |
| 1110 | |
| 1111 | // https://tc39.es/ecma262/#prod-VariableStatement |
| 1112 | // https://tc39.es/ecma262/#prod-LexicalDeclaration |
nothing calls this directly
no test coverage detected