[Pkg-javascript-commits] [node-acorn-jsx] 331/484: Loose: fix pattern+defaults case in function params.
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:51 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-acorn-jsx.
commit 9cdc6809cede95e0447363abb60e06853dae248d
Author: Ingvar Stepanyan <me at rreverser.com>
Date: Mon Oct 27 00:57:19 2014 +0200
Loose: fix pattern+defaults case in function params.
---
acorn_loose.js | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/acorn_loose.js b/acorn_loose.js
index 0546d19..c724398 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -852,18 +852,20 @@
pushCx();
var params = parseExprList(tt.parenR);
for (var i = 0; i < params.length; i++) {
- var param = toAssignable(params[i]), defValue = null;
+ var param = params[i], defValue = null;
+ if (param.type === "AssignmentExpression") {
+ defValue = param.right;
+ param = param.left;
+ }
+ param = toAssignable(param);
if (param.type === "SpreadElement") {
param = param.argument;
if (i === params.length - 1) {
node.rest = param;
continue;
}
- } else if (param.type === "AssignmentExpression") {
- defValue = param.right;
- param = param.left;
}
- node.params.push(checkLVal(param));
+ node.params.push(param);
defaults.push(defValue);
if (defValue) hasDefaults = true;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list