Commit 19772e5
committed
fix(linter/no-unused-vars): panic when variable is redeclared as function in same scope (#11280)
* close: #11215
* close: #11234
```js
var a;
function a() { a() }
```
The above code is legal; in this case, the symbol_declaration points to `var a` rather than `function a`a because the current implementation handles them in order they declared, thus we need to iterate over `symbol_redeclarations` to find the function's node id.1 parent 4bc2650 commit 19772e5
2 files changed
+32
-3
lines changedLines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
206 | 224 | | |
207 | 225 | | |
208 | 226 | | |
| |||
Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
745 | 745 | | |
746 | 746 | | |
747 | 747 | | |
748 | | - | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
749 | 760 | | |
750 | 761 | | |
751 | 762 | | |
| |||
860 | 871 | | |
861 | 872 | | |
862 | 873 | | |
863 | | - | |
864 | | - | |
| 874 | + | |
| 875 | + | |
865 | 876 | | |
866 | 877 | | |
867 | 878 | | |
| |||
0 commit comments