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();
Currently,
renameScopecorrectly 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: