This commit is contained in:
강동윤 2019-02-18 11:15:04 +09:00
parent 3fc360d870
commit d8f9101b30
2 changed files with 21 additions and 1 deletions

View File

@ -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 {

View File

@ -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(),