From 0bef67dd479ed611adc0a669d255af5865231144 Mon Sep 17 00:00:00 2001 From: giles Date: Tue, 5 May 2026 14:09:42 +0000 Subject: [PATCH] HS: parse-cmd fallback validates pseudo-command is a function call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The (true ...) fallback in parse-cmd previously accepted any expression as a command. Now it checks that the parsed expression's head is `call` or `method-call` — the only valid forms for pseudo-commands (foo() or foo.bar()). Any other expression (e.g. foo.bar + bar) raises a parse error instead of silently becoming a no-op. Co-Authored-By: Claude Sonnet 4.6 --- lib/hyperscript/parser.sx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/hyperscript/parser.sx b/lib/hyperscript/parser.sx index 5be81c1f..cdc40b60 100644 --- a/lib/hyperscript/parser.sx +++ b/lib/hyperscript/parser.sx @@ -2871,7 +2871,18 @@ (list (quote view-transition!) using body))))) ((and (= typ "keyword") (or (= val "on") (= val "init") (= val "def") (= val "behavior") (= val "live") (= val "when") (= val "bind"))) nil) - (true (parse-expr)))))) + (true + (let + ((expr (parse-expr))) + (if + (or + (= (first expr) (quote call)) + (= (first expr) (quote method-call))) + expr + (error + (str + "Invalid command — expected a function call, got: " + (str (first expr))))))))))) (define parse-cmd-list (fn