Skip to content

Commit

Permalink
fix: don鈥檛 add function name when operator is not = (#11361)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Apr 2, 2020
1 parent 9444713 commit c3042cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/babel-helper-function-name/src/index.js
Expand Up @@ -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) {
Expand Down
Expand Up @@ -11,3 +11,5 @@ baz = 12;
bar = function() {
bar();
};

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

qux += function () {};

0 comments on commit c3042cf

Please sign in to comment.