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:
Diogo Franco (Kovensky)
2016-12-16 11:14:39 +09:00
parent e06faa99da
commit ccf2f56085
7 changed files with 23 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ import nameFunction from "babel-helper-function-name";
export default function () {
return {
visitor: {
"ArrowFunctionExpression|FunctionExpression": {
FunctionExpression: {
exit(path) {
if (path.key !== "value" && !path.parentPath.isObjectProperty()) {
let replacement = nameFunction(path);