Repository navigation
Commit 4522a1a
authored
perf(javascript): print a simple function's call as its value in the one pass (#22956)
* perf(javascript): print a simple function's call as its value in the one pass
terser's `inline` of simple functions: a function written in place, or
moved to its one read, whose body only returns an expression and which
is passed nothing, or for each parameter a name never written, prints
as that expression, each parameter read as the name passed for it.
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC
* fix(javascript): keep a reduced call a value where typeof, delete or a call reads a reference
A call printed as the name or member it returns stays a value in the
one pass, so `typeof` still throws on an undeclared name, `delete`
removes nothing and a returned method is called without its object.
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC
* fix(javascript): keep a call holding a comment that prints in the one pass
A call printed as what its function returns drops its arguments and
the function's body, so one holding a comment that prints anywhere stays
a call.
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC
* fix(javascript): keep a moved function's reduced call a value where a reference is read
A call of a function moved to its one read, printed as the name or
member it returns, stays a value under `typeof`, `delete` or a call,
as one written in place already does.
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC
* fix(javascript): keep a call whose value reads eval, an arrow's this or a name in its dead zone
The one pass printed a call as what its function returns where that
read a direct `eval` or, through an arrow, the function's `this` and
`arguments`, which then read the caller's, and passed a `let` or
`const` read before its declaration, which then never threw.
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC
* fix(javascript): check a moved call's arguments in the function it is read in
A function moved to its one call and printed as its value checked the
`let` and `const` names passed it against the program once the walk
ended, not the function the call is read in.
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC
* test(javascript): cover each reduced call shape the one pass prints
Claude-Session: https://claude.ai/code/session_01Tgxgyb4N35ndP6cC4KcrXC1 parent 573ed5e commit 4522a1a
3 files changed
Lines changed: 342 additions & 10 deletions
File tree
- .changeset
- lib/javascript
- test/unitCases/javascript
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments