HS: targeted arith-only pseudo-cmd guard — allow all expr statements (+45 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
The previous callable check (0bef67dd) was too strict, rejecting legitimate
pseudo-commands like 'as' conversions, array literals, and property accesses.
The new approach:
- at-end? returns nil (trailing-then EOF guard, unchanged)
- arithmetic expressions (op symbols +/-/*//%) throw 'Pseudo-commands must
be function calls', matching upstream _hyperscript behaviour
- everything else (literals, calls, as-expr, arrays, refs) passes through
Handles both hs-span-mode=false (raw list with op as first) and true (dict
with :kind "arith"). pseudoCommand 11/11, asExpression 36/42, arrayLiteral
8/8, breakpoint 2/2, evalStatically 8/8, regressions 16/16.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2871,7 +2871,28 @@
|
|||||||
(list (quote view-transition!) using body)))))
|
(list (quote view-transition!) using body)))))
|
||||||
((and (= typ "keyword") (or (= val "on") (= val "init") (= val "def") (= val "behavior") (= val "live") (= val "when") (= val "bind")))
|
((and (= typ "keyword") (or (= val "on") (= val "init") (= val "def") (= val "behavior") (= val "live") (= val "when") (= val "bind")))
|
||||||
nil)
|
nil)
|
||||||
(true (if (at-end?) nil (parse-expr)))))))
|
(true
|
||||||
|
(if
|
||||||
|
(at-end?)
|
||||||
|
nil
|
||||||
|
(let
|
||||||
|
((expr (parse-expr)))
|
||||||
|
(if
|
||||||
|
(if
|
||||||
|
(and (dict? expr) (get expr :hs-ast))
|
||||||
|
(= (get expr :kind) "arith")
|
||||||
|
(and
|
||||||
|
(list? expr)
|
||||||
|
(let
|
||||||
|
((h (first expr)))
|
||||||
|
(or
|
||||||
|
(= h (quote +))
|
||||||
|
(= h (quote -))
|
||||||
|
(= h (quote *))
|
||||||
|
(= h (quote /))
|
||||||
|
(= h (make-symbol "%"))))))
|
||||||
|
(error "Pseudo-commands must be function calls")
|
||||||
|
expr))))))))
|
||||||
(define
|
(define
|
||||||
parse-cmd-list
|
parse-cmd-list
|
||||||
(fn
|
(fn
|
||||||
|
|||||||
@@ -2871,7 +2871,28 @@
|
|||||||
(list (quote view-transition!) using body)))))
|
(list (quote view-transition!) using body)))))
|
||||||
((and (= typ "keyword") (or (= val "on") (= val "init") (= val "def") (= val "behavior") (= val "live") (= val "when") (= val "bind")))
|
((and (= typ "keyword") (or (= val "on") (= val "init") (= val "def") (= val "behavior") (= val "live") (= val "when") (= val "bind")))
|
||||||
nil)
|
nil)
|
||||||
(true (if (at-end?) nil (parse-expr)))))))
|
(true
|
||||||
|
(if
|
||||||
|
(at-end?)
|
||||||
|
nil
|
||||||
|
(let
|
||||||
|
((expr (parse-expr)))
|
||||||
|
(if
|
||||||
|
(if
|
||||||
|
(and (dict? expr) (get expr :hs-ast))
|
||||||
|
(= (get expr :kind) "arith")
|
||||||
|
(and
|
||||||
|
(list? expr)
|
||||||
|
(let
|
||||||
|
((h (first expr)))
|
||||||
|
(or
|
||||||
|
(= h (quote +))
|
||||||
|
(= h (quote -))
|
||||||
|
(= h (quote *))
|
||||||
|
(= h (quote /))
|
||||||
|
(= h (make-symbol "%"))))))
|
||||||
|
(error "Pseudo-commands must be function calls")
|
||||||
|
expr))))))))
|
||||||
(define
|
(define
|
||||||
parse-cmd-list
|
parse-cmd-list
|
||||||
(fn
|
(fn
|
||||||
|
|||||||
Reference in New Issue
Block a user