add iife detection to non-identifier params in default parameters
This commit is contained in:
parent
9afa3f6b58
commit
b06f99ab30
@ -9,7 +9,7 @@ exports.check = function (node) {
|
||||
|
||||
var hasDefaults = function (node) {
|
||||
for (var i = 0; i < node.params.length; i++) {
|
||||
if (t.isAssignmentPattern(node.params[i])) return true;
|
||||
if (!t.isIdentifier(node.params[i])) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@ -54,9 +54,15 @@ exports.Function = function (node, parent, scope, file) {
|
||||
|
||||
if (!t.isAssignmentPattern(param)) {
|
||||
lastNonDefaultParam = i + 1;
|
||||
|
||||
if (!t.isIdentifier(param)) {
|
||||
scope.traverse(param, iifeVisitor, state);
|
||||
}
|
||||
|
||||
if (file.transformers["es6.blockScopingTDZ"].canRun()) {
|
||||
pushDefNode(param, t.identifier("undefined"), i);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user