Semantic Diff

#9262 Keep @directive on @this functions

2 commits

827be160cce2386954ea3cf27d3c106540cb2bf6..pr-9262

66d6998c8 · cknitt + Claude · Nov 07, 2026, 15:28 UTC

Keep @directive on @this functions

Why

The @this rewrite left @directive on the unsafe_to_method call instead of the function, and the Pjs_fn_method path built the JS function without a directive, so it was dropped without a report. The PPX now moves @directive onto the inner function, E.method_ takes it, and the printer puts it before let self = this, since a directive must be the first statement of the body.

modifiedJS @this function with a directive

let plain = @this @directive("'use cache'") (self, x) => self + x
js
Before
After
function plain(x) {function plain(x) { 'use cache'; let self = this ; let self = this ; return self + x | 0; return self + x | 0;}}

Fixes #9197

ac091eec0 · cknitt + Claude · Nov 07, 2026, 15:41 UTC

Print the this binding of a method without a space before the semicolon

The space was left over from when the printer spelled out let self = by hand; no other statement puts a space before its semicolon.

modifiedJS @this function

let even = @this (o, x) => x + o
js
Before
After
let o = this ;let o = this;