Add support for printing optional catch binding (#2570)
parent
2560a51f7d
commit
4c335cae0a
|
@ -23,7 +23,8 @@ function parse(text, parsers, opts) {
|
|||
"functionSent",
|
||||
"dynamicImport",
|
||||
"numericSeparator",
|
||||
"importMeta"
|
||||
"importMeta",
|
||||
"optionalCatchBinding"
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
@ -1552,9 +1552,8 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
]);
|
||||
case "CatchClause":
|
||||
return concat([
|
||||
"catch (",
|
||||
path.call(print, "param"),
|
||||
") ",
|
||||
"catch ",
|
||||
n.param ? concat(["(", path.call(print, "param"), ") "]) : "",
|
||||
path.call(print, "body")
|
||||
]);
|
||||
case "ThrowStatement":
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`optional_catch_binding.js 1`] = `
|
||||
try {
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
try {
|
||||
} catch {
|
||||
} finally {
|
||||
}
|
||||
|
||||
`;
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, { parser: "babylon" });
|
|
@ -0,0 +1,9 @@
|
|||
try {
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
Loading…
Reference in New Issue