Update swc_ecma_utils (#927)

This commit is contained in:
강동윤 2020-08-03 00:47:23 +09:00 committed by GitHub
parent 5baa636a4b
commit 54e0bfd878
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 12 deletions

View File

@ -679,3 +679,19 @@ to!(
}",
"export abstract class Kernel {}"
);
to!(
issue_926,
"class A extends Object {
constructor(public a, private b) {
super();
}
}",
"class A extends Object {
constructor(a, b){
super();
this.a = a;
this.b = b;
}
}"
);

View File

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

View File

@ -1458,20 +1458,20 @@ pub fn prepend_stmts<T: StmtLike>(
) {
let idx = to
.iter()
.position(|item| match item.as_stmt() {
Some(&Stmt::Expr(ExprStmt { ref expr, .. }))
if match &**expr {
Expr::Lit(Lit::Str(..)) => true,
.position(|item| {
match item.as_stmt() {
Some(&Stmt::Expr(ExprStmt { ref expr, .. })) => match &**expr {
Expr::Lit(Lit::Str(..)) => return false,
Expr::Call(expr) => match expr.callee {
ExprOrSuper::Super(_) => true,
ExprOrSuper::Expr(_) => false,
ExprOrSuper::Super(_) => return false,
ExprOrSuper::Expr(_) => {}
},
_ => false,
} =>
{
false
_ => {}
},
_ => {}
}
_ => true,
true
})
.unwrap_or(to.len());