Skip to content

Commit bbd6eb7

Browse files
authored
Merge pull request webpack#3250 from Kovensky/issue-3238
Fix issue webpack#3238
2 parents b020954 + a8fd8e5 commit bbd6eb7

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

lib/Parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ Parser.prototype.inScope = function inScope(params, fn) {
909909
};
910910

911911
Parser.prototype.enterPattern = function enterPattern(pattern, onIdent) {
912-
if(this["enter" + pattern.type])
912+
if(pattern != null && this["enter" + pattern.type])
913913
return this["enter" + pattern.type](pattern, onIdent);
914914
};
915915

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
it("supports empty element in destructuring", function() {
2+
const second = ([, x]) => x;
3+
second([1, 2]).should.eql(2);
4+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring");
2+
3+
module.exports = function(config) {
4+
return !config.minimize && supportsIteratorDestructuring();
5+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = function supportsIteratorDestructuring() {
2+
try {
3+
var f = eval("(function f([, x, ...y]) { return x; })");
4+
return f([1, 2]) === 2;
5+
} catch(e) {
6+
return false;
7+
}
8+
};

0 commit comments

Comments
 (0)