Skip to content

Commit

Permalink
restore legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jun 21, 2022
1 parent fc97108 commit 6b3ae16
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions packages/babel-traverse/src/scope/lib/renamer.ts
Expand Up @@ -74,12 +74,41 @@ export default class Renamer {
);
}

maybeConvertFromClassFunctionDeclaration() {
return; // TODO
maybeConvertFromClassFunctionDeclaration(path: NodePath) {
return path; // TODO

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

// if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return;
// if (this.binding.kind !== "hoisted") return;

// path.node.id = identifier(this.oldName);
// path.node._blockHoist = 3;

// path.replaceWith(
// variableDeclaration("let", [
// variableDeclarator(identifier(this.newName), toExpression(path.node)),
// ]),
// );
}

maybeConvertFromClassFunctionExpression() {
return; // TODO
maybeConvertFromClassFunctionExpression(path: NodePath) {
return path; // TODO

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

// if (!path.isFunctionExpression() && !path.isClassExpression()) return;
// if (this.binding.kind !== "local") return;

// path.node.id = identifier(this.oldName);

// this.binding.scope.parent.push({
// id: identifier(this.newName),
// });

// path.replaceWith(
// assignmentExpression("=", identifier(this.newName), path.node),
// );
}

rename(block?: t.Pattern | t.Scopable) {
Expand Down Expand Up @@ -118,8 +147,8 @@ export default class Renamer {
}

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

0 comments on commit 6b3ae16

Please sign in to comment.