Commit 0dfb071
authored
JS optimizer: Fix scoping issues with non-defined functions (#23159)
Other than simple defined functions (function foo() {}), JS also has
arrow functions and object methods. We need to be aware of those
in metadce.
This fixes #22968 which was an issue with an object method that
enclosed a function of the same name as another toplevel function.
To fix this, this PR makes us aware of such scopes, and we do not
optimize functions in them. That is, we only ever optimize defined
functions at the toplevel scope, and anything enclosed is considered
fixed.1 parent ebd6f3c commit 0dfb071
File tree
4 files changed
+234
-147
lines changed- test
- js_optimizer
- tools
4 files changed
+234
-147
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2896 | 2896 | | |
2897 | 2897 | | |
2898 | 2898 | | |
| 2899 | + | |
2899 | 2900 | | |
2900 | 2901 | | |
2901 | 2902 | | |
| |||
0 commit comments