coerce inferred function name to a valid identifier
This commit is contained in:
parent
8065c981dc
commit
f6512b45d5
@ -29,10 +29,13 @@ exports.FunctionExpression = function (node, parent, scope) {
|
|||||||
|
|
||||||
if (!t.isIdentifier(id)) return;
|
if (!t.isIdentifier(id)) return;
|
||||||
|
|
||||||
|
var name = t.toIdentifier(id.name);
|
||||||
|
id = t.identifier(name);
|
||||||
|
|
||||||
// check to see if we have a local binding of the id we're setting inside of
|
// check to see if we have a local binding of the id we're setting inside of
|
||||||
// the function, this is important as there are caveats associated
|
// the function, this is important as there are caveats associated
|
||||||
|
|
||||||
var bindingInfo = scope.getOwnBindingInfo(id.name);
|
var bindingInfo = scope.getOwnBindingInfo(name);
|
||||||
|
|
||||||
if (bindingInfo) {
|
if (bindingInfo) {
|
||||||
if (bindingInfo.type === "param") {
|
if (bindingInfo.type === "param") {
|
||||||
@ -65,11 +68,11 @@ exports.FunctionExpression = function (node, parent, scope) {
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
var binding = scope.getBindingIdentifier(id.name);
|
var binding = scope.getBindingIdentifier(name);
|
||||||
var outerId;
|
var outerId;
|
||||||
|
|
||||||
scope.traverse(node, propertyFunctionVisitor, {
|
scope.traverse(node, propertyFunctionVisitor, {
|
||||||
name: id.name,
|
name: name,
|
||||||
binding: binding,
|
binding: binding,
|
||||||
|
|
||||||
getOuter: function () {
|
getOuter: function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user