Remove invoke from platform interfaces, add cek-call integration tests
- platform_js.py: remove invoke function definition and PRIMITIVES registration, switch domListen handler wrapping to cek-call - platform_py.py: remove invoke function definition - run_signal_tests.py: remove invoke patch, use cek_call in batch wrapper - run_cek_reactive_tests.py: remove invoke, fix primitive lookup to use two-level is_primitive/get_primitive, increase recursion limit for interpreted CEK evaluation - test-cek-reactive.sx: add 7 new tests covering cek-call dispatch with computed, effect, cleanup, batch coalescing All 79 tests pass (20 signal + 43 CEK + 16 CEK reactive). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import os, sys
|
||||
_HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
_PROJECT = os.path.abspath(os.path.join(_HERE, "..", "..", ".."))
|
||||
sys.path.insert(0, _PROJECT)
|
||||
sys.setrecursionlimit(20000)
|
||||
|
||||
from shared.sx.parser import parse_all
|
||||
from shared.sx.ref import sx_ref
|
||||
@@ -138,8 +139,8 @@ env["env-merge"] = env_merge
|
||||
env["symbol-name"] = lambda s: s.name if isinstance(s, Symbol) else str(s)
|
||||
env["keyword-name"] = lambda k: k.name if isinstance(k, Keyword) else str(k)
|
||||
env["type-of"] = sx_ref.type_of
|
||||
env["primitive?"] = lambda n: n in sx_ref.PRIMITIVES
|
||||
env["get-primitive"] = lambda n: sx_ref.PRIMITIVES.get(n)
|
||||
env["primitive?"] = sx_ref.is_primitive
|
||||
env["get-primitive"] = sx_ref.get_primitive
|
||||
env["strip-prefix"] = lambda s, p: s[len(p):] if s.startswith(p) else s
|
||||
env["inspect"] = repr
|
||||
env["debug-log"] = lambda *args: None
|
||||
@@ -201,16 +202,6 @@ env["call-thunk"] = lambda f, e: f() if callable(f) else trampoline(eval_expr([f
|
||||
env["dict-get"] = lambda d, k: d.get(k, NIL) if isinstance(d, dict) else NIL
|
||||
env["identical?"] = lambda a, b: a is b
|
||||
|
||||
def _invoke(f, *args):
|
||||
"""Call f with args — handles both native callables and SX lambdas."""
|
||||
if isinstance(f, Lambda):
|
||||
return trampoline(sx_ref.call_lambda(f, list(args), env))
|
||||
elif callable(f):
|
||||
return f(*args)
|
||||
return NIL
|
||||
|
||||
env["invoke"] = _invoke
|
||||
|
||||
# defhandler, defpage, defquery, defaction stubs
|
||||
for name in ["sf-defhandler", "sf-defpage", "sf-defquery", "sf-defaction"]:
|
||||
pyname = name.replace("-", "_")
|
||||
|
||||
Reference in New Issue
Block a user