]> git.kaiwu.me - njs.git/commit
Preserve "this" for grouped optional calls.
authorDmitry Volyntsev <xeioex@nginx.com>
Wed, 4 Mar 2026 04:40:19 +0000 (20:40 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Thu, 12 Mar 2026 22:26:01 +0000 (15:26 -0700)
commitc015c830940b1b935bcacb7292043aa41c0e7066
treeea6887a3e4917c1765dbf2f548d1904d1f153fe7
parenta2dbceee4155ec666e290197284e897a5ac4af97
Preserve "this" for grouped optional calls.

Previously, grouped optional calls like (o?.m)() resolved the callee
through the optional chain but dispatched via plain FUNCTION_CALL,
losing the original receiver.

The fix stores the receiver on the call node so the upcoming
call-argument reorder can emit METHOD_FRAME with an explicit "this".
Call-expression setup and optional-chain preserve lookup are routed
through named helpers with generator-side validation.
src/njs_generator.c
src/njs_parser.c