Comparing version 4.4.4 to 4.4.5
@@ -18,45 +18,16 @@ "use strict"; | ||
state.selfReference = true; | ||
state.references.push(this); | ||
if (t.isPattern(parent) || t.isAssignmentExpression(parent) || t.isUpdateExpression(parent)) { | ||
state.selfAssignment = true; | ||
} | ||
this.stop(); | ||
} | ||
}; | ||
var wrapIncludesSelfReference = function (state, method, id, scope) { | ||
var outerId = scope.generateUidIdentifier("getOuter"); | ||
var outerIdCall = t.callExpression(outerId, []); | ||
for (var i = 0; i < state.references.length; i++) { | ||
state.references[i].replaceNode(outerIdCall); | ||
} | ||
method.id = id; | ||
return util.template("named-function", { | ||
GET_OUTER_ID: outerId, | ||
FUNCTION_ID: id, | ||
FUNCTION: method | ||
}); | ||
}; | ||
var wrapIncludesSelfAssignment = function (state, method, id, scope) { | ||
var templateName = "property-method-assignment-wrapper"; | ||
if (method.generator) templateName += "-generator"; | ||
return util.template(templateName, { | ||
FUNCTION: method, | ||
FUNCTION_ID: id, | ||
FUNCTION_KEY: scope.generateUidIdentifier(id.name), | ||
WRAPPER_KEY: scope.generateUidIdentifier(id.name + "Wrapper") | ||
}); | ||
}; | ||
var wrap = function (state, method, id, scope) { | ||
if (state.selfReference) { | ||
if (state.selfAssignment) { | ||
return wrapIncludesSelfAssignment(state, method, id, scope); | ||
} else { | ||
return wrapIncludesSelfReference(state, method, id, scope); | ||
} | ||
var templateName = "property-method-assignment-wrapper"; | ||
if (method.generator) templateName += "-generator"; | ||
return util.template(templateName, { | ||
FUNCTION: method, | ||
FUNCTION_ID: id, | ||
FUNCTION_KEY: scope.generateUidIdentifier(id.name), | ||
WRAPPER_KEY: scope.generateUidIdentifier(id.name + "Wrapper") | ||
}); | ||
} else { | ||
@@ -96,3 +67,2 @@ method.id = id; | ||
// with the same id | ||
state.selfAssignment = true; | ||
state.selfReference = true; | ||
@@ -99,0 +69,0 @@ } else { |
{ | ||
"name": "babel", | ||
"description": "Turn ES6 code into readable vanilla ES5 with source maps", | ||
"version": "4.4.4", | ||
"version": "4.4.5", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://babeljs.io/", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158
1603935
13485