Files
rose-ash/lib/hyperscript/runtime.sx
giles 122053eda3 HS: namespaced def + script-tag global functions (+3 tests)
Runtime: hs-method-call gains a fallback case — when method isn't one of
the built-in collection ops (map/push/filter/join/indexOf), look up the
method name as a property on obj via host-get; if the value is callable,
invoke via apply with the call args. This makes namespaced calls like
`utils.foo()` work when utils is an SX dict whose foo entry is an SX fn.

Generator: hand-rolled deftests for the 3 cluster-35 tests:
- `is called synchronously` and `can call asynchronously`: pre-evaluate
  the script-tag def via `(eval-expr-cek (hs-to-sx (first (hs-parse
  (hs-tokenize "def foo() ... end")))))` so foo lands in the global eval
  env, then build a click div via dom-set-attr + hs-boot-subtree! and
  exercise it via dom-dispatch click.
- `functions can be namespaced`: hand-build `(define utils (dict))` then
  `(host-set! utils "foo" __utils_foo)` (the def is registered under a
  fresh sym since the parser doesn't yet support `def utils.foo()` dotted
  names), and rely on the new hs-method-call fallback to dispatch
  `utils.foo()` through host-get/apply.

Removed the 3 def entries from SKIP_TEST_NAMES.

hs-upstream-def: 24/27 → 27/27. Smoke 0-195 unchanged at 172/195.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 12:37:39 +00:00

71 KiB