Don't try to visit ArrowFunctionExpression, they cannot be named
They will still be visited if the arrow functions are transformed to regular functions. Fixes #5004
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
const x = () => x;
|
||||
const y = x => x();
|
||||
const z = { z: () => y(x) }.z;
|
||||
@@ -0,0 +1,9 @@
|
||||
const x = function x() {
|
||||
return x;
|
||||
};
|
||||
const y = function y(x) {
|
||||
return x();
|
||||
};
|
||||
const z = { z: function z() {
|
||||
return y(x);
|
||||
} }.z;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-es2015-function-name", "transform-es2015-arrow-functions"]
|
||||
}
|
||||
2
packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/actual.js
vendored
Normal file
2
packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const x = ({x}) => x;
|
||||
export const y = function () {};
|
||||
2
packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/expected.js
vendored
Normal file
2
packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/expected.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const x = ({ x }) => x;
|
||||
export const y = function y() {};
|
||||
3
packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/options.json
vendored
Normal file
3
packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-es2015-function-name"]
|
||||
}
|
||||
Reference in New Issue
Block a user