super() should be first (#918)

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
This commit is contained in:
LongYinan 2020-07-31 23:55:13 +08:00 committed by GitHub
parent 0ac55ae68b
commit 0a7f3a28ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

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

View File

@ -656,3 +656,18 @@ to!(
newLine = encoder.encode("\r\n");
}"#
);
to!(
issue_912,
r#"export class BadRequestError extends Error {
constructor(public readonly message: string) {
super(message)
}
}"#,
r#"export class BadRequestError extends Error {
constructor(message) {
super(message)
this.message = message
}
}"#
);

View File

@ -1462,6 +1462,10 @@ pub fn prepend_stmts<T: StmtLike>(
Some(&Stmt::Expr(ExprStmt { ref expr, .. }))
if match &**expr {
Expr::Lit(Lit::Str(..)) => true,
Expr::Call(expr) => match expr.callee {
ExprOrSuper::Super(_) => true,
ExprOrSuper::Expr(_) => false,
},
_ => false,
} =>
{