[Pkg-javascript-commits] [node-acorn-jsx] 296/484: Guard against missing elements in array patterns when checking function parameters.
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:46 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 e9c7209f8b6e28f9bb94c44db0e7e0352de1edf0
Author: Max Schaefer <max at semmle.com>
Date: Thu Oct 9 13:52:08 2014 +0100
Guard against missing elements in array patterns when checking function parameters.
---
acorn.js | 6 ++++--
test/tests-harmony.js | 2 ++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/acorn.js b/acorn.js
index f1872f4..2da669c 100644
--- a/acorn.js
+++ b/acorn.js
@@ -1391,8 +1391,10 @@
break;
case "ArrayPattern":
- for (var i = 0; i < param.elements.length; i++)
- checkFunctionParam(param.elements[i], nameHash);
+ for (var i = 0; i < param.elements.length; i++) {
+ var elem = param.elements[i];
+ if (elem) checkFunctionParam(elem, nameHash);
+ }
break;
}
}
diff --git a/test/tests-harmony.js b/test/tests-harmony.js
index deeb049..01010e9 100644
--- a/test/tests-harmony.js
+++ b/test/tests-harmony.js
@@ -15389,3 +15389,5 @@ test('function normal(x, y = 10) {}', {
expression: false
}]
}, {ecmaVersion: 6});
+
+test("'use strict'; function f([x,,z]) {}", {}, {ecmaVersion: 6});
--
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