Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object destructuring in function arguments causes an error #2

Open
re-engineer opened this issue Aug 5, 2020 · 1 comment · May be fixed by #4
Open

Object destructuring in function arguments causes an error #2

re-engineer opened this issue Aug 5, 2020 · 1 comment · May be fixed by #4

Comments

@re-engineer
Copy link

Currently, renameScope correctly handles argument-renaming logic only in cases of arguments without array/object destructuring or any other AST structures which cause the parent of the variable declaration not to be the argument list. For example, the following code fails:

import {refactor} from "shift-refactor";
import {commonMethods} from "refactor-plugin-common";
const code=`
function g(m,p=1){
  return m+p;
}
`;
const $script=refactor(code,commonMethods);
$script.normalizeIdentifiers(); 
@jsoverson
Copy link
Owner

jsoverson commented Aug 7, 2020

Thanks for opening the issue and the test case.

@re-engineer re-engineer linked a pull request Nov 2, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants