fix(javascript): share immediately returned loader facts

Reuse the existing direct-call returned-reference owner for immediate synchronous function results and feed proven loader facts into historical imports. Simple returned require retains its identity; mixed, opaque, and canonical shim alternatives retain explicit uncertainty rather than disappearing.

Focused semantic, Electron, and public CLI regressions passed, including CommonJS, ESM, async/generator, mutable argument, direct-loader, and source-provenance controls. No runtime target or Proxy evaluator was introduced.

Fixes #3535
This commit is contained in:
morluto
2026-10-24 07:28:09 +08:00
parent 9d7779d365
commit 36f528efcb
4 changed files with 265 additions and 12 deletions
+9
View File
@@ -501,6 +501,15 @@ Identifier references and closure captures share Babel syntax-role facts plus
explicit binding/write roles; noncomputed declaration keys and import/meta names
are not lexical reads. Provenance-only expression-depth omissions enter the same typed source coverage
as value-evaluation bounds and remain visible in retained application Evidence.
Immediate synchronous function results also share the loader reference owner.
An expression arrow returning the retained CommonJS `require` can preserve that
loader identity. Possible loader results with opaque alternatives or block
bodies retain candidate uncertainty; async and generator results are their
wrapper values.
This does not interpret `typeof` or Proxy behavior in bundler shims. Historical
source imports consume the same proven loader fact and keep their existing
requirement for a known loader association.
Direct generator and async calls produce iterators and
Promises; body returns do not become direct call-result flows. Their unresolved
consumption remains an explicit frontier. Replaced emitter bindings select their