Skip to content

Object destructuring in function arguments causes an error #2

Description

@re-engineer

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions