retrofit try-catch-finally as block-scoped (#4178)

- support optional catch binding
This commit is contained in:
Alex Lam S.L
2020-10-04 22:30:14 +01:00
committed by GitHub
parent f9946767c9
commit 8f0521d51d
8 changed files with 74 additions and 19 deletions

View File

@@ -1130,9 +1130,12 @@ function parse($TEXT, options) {
if (is("keyword", "catch")) {
var start = S.token;
next();
expect("(");
var name = as_symbol(AST_SymbolCatch);
expect(")");
var name = null;
if (is("punc", "(")) {
next();
name = as_symbol(AST_SymbolCatch);
expect(")");
}
bcatch = new AST_Catch({
start : start,
argname : name,