diff options
Diffstat (limited to 'node_modules/babel-traverse/lib')
-rw-r--r-- | node_modules/babel-traverse/lib/path/replacement.js | 2 | ||||
-rw-r--r-- | node_modules/babel-traverse/lib/scope/lib/renamer.js | 32 |
2 files changed, 1 insertions, 33 deletions
diff --git a/node_modules/babel-traverse/lib/path/replacement.js b/node_modules/babel-traverse/lib/path/replacement.js index a60c73d54..411dacf3f 100644 --- a/node_modules/babel-traverse/lib/path/replacement.js +++ b/node_modules/babel-traverse/lib/path/replacement.js @@ -140,7 +140,7 @@ function replaceWith(replacement) { } if (this.isNodeType("Statement") && t.isExpression(replacement)) { - if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) { + if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) { replacement = t.expressionStatement(replacement); } } diff --git a/node_modules/babel-traverse/lib/scope/lib/renamer.js b/node_modules/babel-traverse/lib/scope/lib/renamer.js index a3b970515..351b4d932 100644 --- a/node_modules/babel-traverse/lib/scope/lib/renamer.js +++ b/node_modules/babel-traverse/lib/scope/lib/renamer.js @@ -80,33 +80,6 @@ var Renamer = function () { } }; - Renamer.prototype.maybeConvertFromClassFunctionDeclaration = function maybeConvertFromClassFunctionDeclaration(path) { - return; - - if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return; - if (this.binding.kind !== "hoisted") return; - - path.node.id = t.identifier(this.oldName); - path.node._blockHoist = 3; - - path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(t.identifier(this.newName), t.toExpression(path.node))])); - }; - - Renamer.prototype.maybeConvertFromClassFunctionExpression = function maybeConvertFromClassFunctionExpression(path) { - return; - - if (!path.isFunctionExpression() && !path.isClassExpression()) return; - if (this.binding.kind !== "local") return; - - path.node.id = t.identifier(this.oldName); - - this.binding.scope.parent.push({ - id: t.identifier(this.newName) - }); - - path.replaceWith(t.assignmentExpression("=", t.identifier(this.newName), path.node)); - }; - Renamer.prototype.rename = function rename(block) { var binding = this.binding, oldName = this.oldName, @@ -131,11 +104,6 @@ var Renamer = function () { } if (binding.type === "hoisted") {} - - if (parentDeclar) { - this.maybeConvertFromClassFunctionDeclaration(parentDeclar); - this.maybeConvertFromClassFunctionExpression(parentDeclar); - } }; return Renamer; |