HS: cluster 11/33 followups (+2 tests)
Three orthogonal fixes that pick up tests now unblocked by earlier cluster-34 (count filters) and cluster-35 (hs-method-call fallback) work: (1) parser.sx parse-hide-cmd / parse-show-cmd — added `on` to the keyword list that signals an implicit-`me` target. Without this, `on click 1 hide on click 2 show` silently parsed as `(hide nil)` because parse-expr greedily started consuming `on` and returned nil. With the bail-out, hide/show default to me when the next token is `on` (a sibling feature). (2) runtime.sx hs-method-call fallback — when method isn't a built-in collection op, look up obj[method] via host-get; if it's an SX-callable (lambda) use apply, but if it's a JS-native function (e.g. cookies.clear on the cookies Proxy) dispatch via `(apply host-call (cons obj (cons method args)))` so the JS native receives the args correctly. SX callable? returns false for JS-native function values, hence the split. (3) generator hs-cleanup! — wrapped body in begin (fn body evaluates only the last expression) and reset two pieces of mutable global runtime state between tests: hs-set-default-hide-strategy! nil and hs-set-log-all! false. The prior `can set default to custom strategy` test (cluster 11) was leaking _hs-default-hide-strategy to subsequent tests, breaking `hide element then show element retains original display` because hs-hide-one! resolved its "display" strategy through the leaked override. Also added cluster-33 hand-roll for `basic clear cookie values work` (uses the new method-call fallback to dispatch cookies.clear via host-call). hs-upstream-hide: 15/16 → 16/16. hs-upstream-expressions/cookies: 3/5 → 4/5. Smoke 0-195 unchanged at 172/195. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1555,7 +1555,7 @@
|
||||
(fn
|
||||
()
|
||||
(let
|
||||
((tgt (cond ((at-end?) (list (quote me))) ((and (= (tp-type) "keyword") (or (= (tp-val) "then") (= (tp-val) "end") (= (tp-val) "with") (= (tp-val) "when") (= (tp-val) "add") (= (tp-val) "remove") (= (tp-val) "set") (= (tp-val) "put") (= (tp-val) "toggle") (= (tp-val) "hide") (= (tp-val) "show"))) (list (quote me))) (true (parse-expr)))))
|
||||
((tgt (cond ((at-end?) (list (quote me))) ((and (= (tp-type) "keyword") (or (= (tp-val) "then") (= (tp-val) "end") (= (tp-val) "with") (= (tp-val) "when") (= (tp-val) "add") (= (tp-val) "remove") (= (tp-val) "set") (= (tp-val) "put") (= (tp-val) "toggle") (= (tp-val) "hide") (= (tp-val) "show") (= (tp-val) "on"))) (list (quote me))) (true (parse-expr)))))
|
||||
(let
|
||||
((strategy (if (match-kw "with") (if (at-end?) "display" (let ((s (tp-val))) (do (adv!) (cond ((at-end?) s) ((= (tp-type) "colon") (do (adv!) (let ((v (tp-val))) (do (adv!) (str s ":" v))))) ((= (tp-type) "local") (let ((v (tp-val))) (do (adv!) (str s ":" v)))) (true s))))) "display")))
|
||||
(let
|
||||
@@ -1566,7 +1566,7 @@
|
||||
(fn
|
||||
()
|
||||
(let
|
||||
((tgt (cond ((at-end?) (list (quote me))) ((and (= (tp-type) "keyword") (or (= (tp-val) "then") (= (tp-val) "end") (= (tp-val) "with") (= (tp-val) "when") (= (tp-val) "add") (= (tp-val) "remove") (= (tp-val) "set") (= (tp-val) "put") (= (tp-val) "toggle") (= (tp-val) "hide") (= (tp-val) "show"))) (list (quote me))) (true (parse-expr)))))
|
||||
((tgt (cond ((at-end?) (list (quote me))) ((and (= (tp-type) "keyword") (or (= (tp-val) "then") (= (tp-val) "end") (= (tp-val) "with") (= (tp-val) "when") (= (tp-val) "add") (= (tp-val) "remove") (= (tp-val) "set") (= (tp-val) "put") (= (tp-val) "toggle") (= (tp-val) "hide") (= (tp-val) "show") (= (tp-val) "on"))) (list (quote me))) (true (parse-expr)))))
|
||||
(let
|
||||
((strategy (if (match-kw "with") (if (at-end?) "display" (let ((s (tp-val))) (do (adv!) (cond ((at-end?) s) ((= (tp-type) "colon") (do (adv!) (let ((v (tp-val))) (do (adv!) (str s ":" v))))) ((= (tp-type) "local") (let ((v (tp-val))) (do (adv!) (str s ":" v)))) (true s))))) "display")))
|
||||
(let
|
||||
|
||||
@@ -2120,6 +2120,7 @@
|
||||
((fn-val (host-get obj method)))
|
||||
(cond
|
||||
((and fn-val (callable? fn-val)) (apply fn-val args))
|
||||
(fn-val (apply host-call (cons obj (cons method args))))
|
||||
(true nil)))))))
|
||||
|
||||
(define hs-beep (fn (v) v))
|
||||
|
||||
Reference in New Issue
Block a user