Skip to content

Commit

Permalink
Remove unused functions from renamer.js. (#5965)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcav authored and hzoo committed Jul 20, 2017
1 parent 81e87b0 commit fe13ba8
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions packages/babel-traverse/src/scope/lib/renamer.js
Expand Up @@ -70,39 +70,6 @@ export default class Renamer {
}
}

maybeConvertFromClassFunctionDeclaration(path) {
return; // TODO

// retain the `name` of a class/function declaration

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))
]));
}

maybeConvertFromClassFunctionExpression(path) {
return; // TODO

// retain the `name` of a class/function expression

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));
}

rename(block?) {
const { binding, oldName, newName } = this;
const { scope, path } = binding;
Expand All @@ -124,10 +91,5 @@ export default class Renamer {
// https://github.com/babel/babel/issues/2435
// todo: hoist and convert function to a let
}

if (parentDeclar) {
this.maybeConvertFromClassFunctionDeclaration(parentDeclar);
this.maybeConvertFromClassFunctionExpression(parentDeclar);
}
}
}

0 comments on commit fe13ba8

Please sign in to comment.