mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 03:01:48 +03:00
Fix #227
This commit is contained in:
parent
3fc360d870
commit
d8f9101b30
@ -66,7 +66,10 @@ impl Params {
|
||||
let len_ident = quote_ident!(span.apply_mark(mark), "_len");
|
||||
|
||||
let arg = match *arg {
|
||||
Pat::Ident(ident) => ident,
|
||||
Pat::Ident(ident) => {
|
||||
params.push(Pat::Ident(ident.clone()));
|
||||
ident
|
||||
}
|
||||
arg => {
|
||||
let tmp_ident = quote_ident!(span.apply_mark(mark), "_tmp");
|
||||
decls_after_unpack.push(VarDeclarator {
|
||||
|
@ -10,6 +10,23 @@ fn tr() -> impl Fold<Module> {
|
||||
)
|
||||
}
|
||||
|
||||
test!(
|
||||
::swc_ecma_parser::Syntax::default(),
|
||||
|_| tr(),
|
||||
issue_227,
|
||||
"export default function fn1(...args) {
|
||||
fn2(...args);
|
||||
}",
|
||||
"
|
||||
export default function fn1(args) {
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
fn2(...args);
|
||||
}
|
||||
"
|
||||
);
|
||||
|
||||
test!(
|
||||
::swc_ecma_parser::Syntax::default(),
|
||||
|_| tr(),
|
||||
|
Loading…
Reference in New Issue
Block a user