Fix typescript stripper (#905)

swc_ecma_codegen:
 - Fix codegen of optional catch parameters (#904)

swc_ecma_transforms:
 - Fix for nested catch clause
This commit is contained in:
강동윤 2020-07-28 00:55:28 +09:00 committed by GitHub
parent c58b9c8649
commit 891092caf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "swc_ecma_codegen"
version = "0.28.2"
version = "0.28.3"
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
license = "Apache-2.0/MIT"
repository = "https://github.com/swc-project/swc.git"

View File

@ -1986,9 +1986,11 @@ impl<'a> Emitter<'a> {
keyword!("catch");
formatting_space!();
if let Some(param) = &node.param {
punct!("(");
emit!(node.param);
emit!(param);
punct!(")");
}
space!();

View File

@ -1,6 +1,6 @@
[package]
name = "swc_ecma_transforms"
version = "0.15.1"
version = "0.15.2"
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
license = "Apache-2.0/MIT"
repository = "https://github.com/swc-project/swc.git"

View File

@ -1,5 +1,5 @@
use swc_ecma_ast::*;
use swc_ecma_visit::Fold;
use swc_ecma_visit::{Fold, FoldWith};
struct OptionalCatchBinding;
@ -10,7 +10,9 @@ pub fn optional_catch_binding() -> impl Fold {
}
impl Fold for OptionalCatchBinding {
fn fold_catch_clause(&mut self, cc: CatchClause) -> CatchClause {
fn fold_catch_clause(&mut self, mut cc: CatchClause) -> CatchClause {
cc = cc.fold_children_with(self);
if cc.param.is_some() {
return cc;
}