Handle esprima-like AST catch clause in a TryStatement. Fixes #473
This commit is contained in:
parent
7b04c501eb
commit
e07e74f010
@ -107,7 +107,16 @@ exports.TryStatement = function (node, print) {
|
|||||||
this.keyword("try");
|
this.keyword("try");
|
||||||
print(node.block);
|
print(node.block);
|
||||||
this.space();
|
this.space();
|
||||||
print(node.handler);
|
|
||||||
|
// Esprima bug puts the catch clause in a `handlers` array.
|
||||||
|
// see https://code.google.com/p/esprima/issues/detail?id=433
|
||||||
|
// We run into this from regenerator generated ast.
|
||||||
|
if (node.handlers) {
|
||||||
|
print(node.handlers[0]);
|
||||||
|
} else {
|
||||||
|
print(node.handler);
|
||||||
|
}
|
||||||
|
|
||||||
if (node.finalizer) {
|
if (node.finalizer) {
|
||||||
this.space();
|
this.space();
|
||||||
this.push("finally ");
|
this.push("finally ");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user