babel-plugin-jscript
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -18,21 +18,7 @@ "use strict"; | ||
FunctionExpression: { | ||
exit: function exit(node, parent) { | ||
exit: function exit(node) { | ||
if (!node.id) return; | ||
node._ignoreUserWhitespace = true; | ||
if (t.isReturnStatement(parent)) { | ||
var parentScopeHasNoBindings = !this.scope.parent || Object.keys(this.scope.parent.bindings).length === 0; | ||
if (parentScopeHasNoBindings) { | ||
// If this FunctionExpression is being returned from a scope | ||
// that has no bindings, then there is no need to wrap it | ||
// with an IIFE, because it's fine if the function name | ||
// leaks into that empty scope (as it will in IE8). This | ||
// clause is mostly to keep the FunctionExpression generated | ||
// below from being transformed again by this plugin. | ||
return; | ||
} | ||
} | ||
return t.callExpression(t.functionExpression(null, [], t.blockStatement([t.returnStatement(node)])), []); | ||
return t.callExpression(t.functionExpression(null, [], t.blockStatement([t.toStatement(node), t.returnStatement(node.id)])), []); | ||
} | ||
@@ -39,0 +25,0 @@ } |
{ | ||
"name": "babel-plugin-jscript", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Babel plugin to fix buggy JScript named function expressions", | ||
@@ -5,0 +5,0 @@ "repository": "babel-plugins/babel-plugin-jscript", |
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
1517
22