Repository navigation
fix(semantics): isolate parameter expression environments - #775
rudycelekli wants to merge 1 commit into
Conversation
Signed-off-by: Rudy Celekli <[email protected]>
|
CI status: the Windows native-controls job was cancelled while preparing the cross compiler, before the build/test steps ran. The two dependent package/Windows checks were skipped; the other fifteen checks passed. I attempted to rerun the incomplete workflow ( |
|
Reviewed: correct isolation of default-param/computed-key expressions from the body var environment. Trigger covers AssignmentPattern, RestElement/ArrayPattern, ObjectPattern computed keys, and methods; expression-free params keep the single env. Param-reference and argument-flow preservation is pinned in both directions plus CLI acceptance. APPROVE. Non-blocking suggestion: consider pinning the duplicate-binding shape (e.g. |
Review — APPROVESummaryIsolates default-parameter expressions and computed destructuring keys from the function body Verification
Suggestion (non-blocking)
|
|
Thanks for the review. I prepared the suggested duplicate-binding control, including a second parameter default referencing the parameter binding; 42 focused tests and the required checks passed. I noticed this PR was subsequently closed without a merge, and current main still has the original parameter/body environment behavior. Was that closure intentional, or would you like the control added and this PR reopened? I have left it closed while clarifying. |
| }, | ||
| ); | ||
|
|
||
| it("retains parameter references and argument flow across the body environment", () => { |
There was a problem hiding this comment.
Suggestion (non-blocking): consider pinning the duplicate-binding shape here, e.g. function run(value = helper()) { var value; ... } yields param-outer / var-inner with body refs resolving inner. Locks the split against a future simplification back to one environment.
|
Thanks, @rudycelekli, for your work on “fix(semantics): isolate parameter expression environments.” I appreciate your contribution to REA. |
Summary
Keep default-parameter expressions and computed destructuring keys outside the function body var environment. The analyzer currently resolves a call in a default expression to a body-local declaration that is not visible there at runtime.
Functions with parameter expressions now have a separate body environment. Expression-free simple, destructured, and rest parameters retain their existing var environment. This is a lexical call-target correction; optional parameter values and cross-function argument values remain conservative.
Native reproduction
For
function run(value = helper()) { function helper() { return 'INNER'; } return value; }, with an outer helper returningOUTER, Node returnsOUTER. The built public analyzer previously linked the default call to the inner helper. It now links that call to the outer helper and retains the body call's inner target.Native/public CLI controls cover a body declaration, body const, and arrow function. Checked regressions also cover body var, methods, default closures, computed/nested destructuring, parameter references, and expression-free var/parameter identity.
Verification
npm run build:cached,npm run check, andnpm run check:fastpass (125 lint warnings, zero errors).3a0405ce88ebff8586c67e6024d5c63b14745b59.No schema, provider, or packaged-artifact behavior changes are claimed. This does not claim complete ECMAScript binding or value analysis. Codex assisted on behalf of @rudycelekli with reproduction, implementation, tests, and an independent source review. Hosted CI runs separately.