[Pkg-javascript-commits] [node-acorn-jsx] 326/484: Loose: Added support for assignment patterns to expression and variables.
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:50 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 4879af22d1e88f6b1b0ffd17bbff23a17038ff92
Author: Ingvar Stepanyan <me at rreverser.com>
Date: Sun Oct 26 23:32:35 2014 +0200
Loose: Added support for assignment patterns to expression and variables.
---
acorn_loose.js | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/acorn_loose.js b/acorn_loose.js
index 87cdbd5..f3523b8 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -498,13 +498,12 @@
function parseVar(node, noIn) {
node.declarations = [];
node.kind = "var";
- while (token.type === tt.name) {
+ do {
var decl = startNode();
- decl.id = parseIdent();
+ decl.id = options.ecmaVersion >= 6 ? toAssignable(parseExprAtom()) : parseIdent();
decl.init = eat(tt.eq) ? parseExpression(true, noIn) : null;
node.declarations.push(finishNode(decl, "VariableDeclarator"));
- if (!eat(tt.comma)) break;
- }
+ } while (eat(tt.comma));
if (!node.declarations.length) {
var decl = startNode();
decl.id = dummyIdent();
@@ -541,7 +540,7 @@
if (token.type.isAssign) {
var node = startNodeAt(start);
node.operator = token.value;
- node.left = checkLVal(left);
+ node.left = token.type === tt.eq ? toAssignable(left) : checkLVal(left);
next();
node.right = parseMaybeAssign(noIn);
return finishNode(node, "AssignmentExpression");
@@ -821,7 +820,7 @@
break;
}
}
- return node;
+ return checkLVal(node);
}
function parseFunctionParams(node) {
--
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