aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-06-06 22:55:25 +0800
committerGitHub <noreply@github.com>2017-06-06 22:55:25 +0800
commitb9ad53d1ab166115dde78493f937782417e78e00 (patch)
tree3923beadc87c4e16f0257d63685d1c40ba046fd9 /lib
parentb0eab71470fa887752bcf5442fbb26da3f724ef1 (diff)
downloadtracifyjs-b9ad53d1ab166115dde78493f937782417e78e00.tar.gz
tracifyjs-b9ad53d1ab166115dde78493f937782417e78e00.zip
fix `inline` handling of `AST_Call.args` (#2059)
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 969acd61..e3846c31 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -3183,19 +3183,21 @@ merge(Compressor.prototype, {
if (body) {
var fn = exp.clone();
fn.argnames = [];
- fn.body = [
- make_node(AST_Var, self, {
+ fn.body = [];
+ if (exp.argnames.length > 0) {
+ fn.body.push(make_node(AST_Var, self, {
definitions: exp.argnames.map(function(sym, i) {
+ var arg = self.args[i];
return make_node(AST_VarDef, sym, {
name: sym,
- value: self.args[i] || make_node(AST_Undefined, self)
+ value: arg ? arg.clone(true) : make_node(AST_Undefined, self)
});
})
- })
- ];
+ }));
+ }
if (self.args.length > exp.argnames.length) {
fn.body.push(make_node(AST_SimpleStatement, self, {
- body: make_sequence(self, self.args.slice(exp.argnames.length))
+ body: make_sequence(self, self.args.slice(exp.argnames.length)).clone(true)
}));
}
fn.body.push(make_node(AST_Return, self, {