fix: don’t add function name when operator is not = (#11361)

This commit is contained in:
Huáng Jùnliàng 2020-04-02 11:12:13 -04:00 committed by GitHub
parent 94447135c7
commit c3042cfd27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -179,7 +179,7 @@ export default function({ node, parent, scope, id }, localBinding = false) {
return;
}
}
} else if (t.isAssignmentExpression(parent)) {
} else if (t.isAssignmentExpression(parent, { operator: "=" })) {
// foo = function () {};
id = parent.left;
} else if (!id) {

View File

@ -11,3 +11,5 @@ baz = 12;
bar = function() {
bar();
};
qux += function() {}

View File

@ -23,3 +23,5 @@ bar = function (_bar) {
}(function () {
bar();
});
qux += function () {};