js-on-sx: globalThis + eval stub transpile-time mappings

JS 'globalThis' now rewrites to SX (js-global) — the global object dict.
JS 'eval' rewrites to js-global-eval, a no-op stub that echoes its first
arg. Many test262 tests probe eval's existence or pass simple literals
through it; a no-op is better than 'Undefined symbol: eval'.

A full eval would require plumbing js-eval into the runtime with access
to the enclosing lexical scope — non-trivial. The stub unblocks tests
that just need eval to be callable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 09:39:28 +00:00
parent 1c0a71517c
commit 094945d86a
2 changed files with 56 additions and 50 deletions

View File

@@ -159,6 +159,8 @@
((= name "undefined") (list (js-sym "quote") :js-undefined))
((= name "NaN") (list (js-sym "js-nan-value")))
((= name "Infinity") (list (js-sym "js-infinity-value")))
((= name "eval") (js-sym "js-global-eval"))
((= name "globalThis") (js-sym "js-global"))
(else (js-sym name)))))
;; ── Unary ops ─────────────────────────────────────────────────────