Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix js2-node-get-enclosing-scope on a statement function's name
When called with a statement function's name node, js2-node-get-enclosing-scope would errorneously return the function itself. That's not really the scope where this name is defined (it should be the function's parent scope). This bug affects js2-refactor's rename variable functionality. Example: (function(){ function |foo() { var |foo = 5; console.log(|foo); } foo(); })(); (where '|' marks possible cursor position). Type M-x js2r-rename-var with the cursor on one of the marked positions, and it'll offer to rename the following occurrences (marked with underscores): (function(){ function _foo_() { var _foo_ = 5; console.log(_foo_); } foo(); })(); This is incorrect, as the name is shadowed inside the function. It should instead rename these two: (function(){ function _foo_() { var foo = 5; console.log(foo); } _foo_(); })(); This patch fixes this.
- Loading branch information