HS: runtimeErrors suite 18/18 — null error reporting fixes
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 36s

- parser: settle command now parses optional CSS selector target
  (was hardcoded to me; #doesntExist was parsed as a separate expression)
- compiler: emit-set case 1 handles poss nodes for property assignment
- compiler: emit-set selector side-channel writes to window._hs_last_query_sel
  via host-set! (was dead SX variable set!)
- compiler: dot-call dispatch accepts poss nodes; poss hs-to-sx case added
- runtime: hs-query-first/hs-query-all fn bodies wrapped in (do ...) so
  host-set! _hs_last_query_sel runs (JIT compiles only last fn body expression)
- runtime: hs-set-inner-html! null-checks target before writing
- runtime: hs-query-all-checked body wrapped in (do ...) so hs-empty-raise!
  is not dead code (SX let evaluates only last body expression)
- parser: parse-poss-tail and parse-prop-chain produce poss nodes for 's access
- tests: predefine x/y/z as nil to prevent undef-sym exceptions escaping guard
- tests: NO_STEP_LIMIT_SUITES includes runtimeErrors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-02 08:25:23 +00:00
parent 19bd2cb92d
commit 7990ee5ffe
4 changed files with 595 additions and 419 deletions

View File

@@ -71,12 +71,14 @@
((typ (tp-type)) (val (tp-val)))
(cond
((or (= typ "ident") (= typ "keyword"))
(do (adv!) (parse-prop-chain (list (quote .) owner val))))
(do
(adv!)
(parse-prop-chain (list (quote poss) owner val))))
((= typ "attr") (do (adv!) (list (quote attr) val owner)))
((= typ "class")
(let
((prop (get (adv!) "value")))
(parse-prop-chain (list (quote .) owner prop))))
(parse-prop-chain (list (quote poss) owner prop))))
((= typ "style") (do (adv!) (list (quote style) val owner)))
(true owner)))))
(define
@@ -116,7 +118,18 @@
(prev-end)
base-line
{:root base})))
base)))))
(if
(and
(= (tp-type) "op")
(= (tp-val) "'s")
(not (at-end?)))
(let
((poss-prop (begin (adv!) (tp-val))))
(do
(adv!)
(parse-prop-chain
(list (make-symbol "poss") base poss-prop))))
base))))))
(define
parse-trav
(fn
@@ -429,8 +442,7 @@
(let
((name val) (args (parse-call-args)))
(cons (quote call) (cons (list (quote ref) name) args)))))
((= typ "keyword")
(do (adv!) (list (quote ref) val)))
((= typ "keyword") (do (adv!) (list (quote ref) val)))
(true nil)))))
(define
parse-poss
@@ -443,10 +455,13 @@
((= (tp-type) "dot")
(do
(adv!)
(let ((typ2 (tp-type)) (val2 (tp-val)))
(let
((typ2 (tp-type)) (val2 (tp-val)))
(if
(or (= typ2 "ident") (= typ2 "keyword"))
(do (adv!) (parse-poss (list (make-symbol ".") obj val2)))
(do
(adv!)
(parse-poss (list (make-symbol ".") obj val2)))
obj))))
((= (tp-type) "paren-open")
(let
@@ -1475,7 +1490,8 @@
((match-kw "to")
(let
((value (parse-expr)))
(if (and (list? tgt) (= (first tgt) (quote query)))
(if
(and (list? tgt) (= (first tgt) (quote query)))
(list (quote set-el!) tgt value)
(list (quote set!) tgt value))))
((match-kw "on")
@@ -2648,7 +2664,14 @@
((and (= typ "keyword") (= val "answer"))
(do (adv!) (parse-answer-cmd)))
((and (= typ "keyword") (= val "settle"))
(do (adv!) (list (quote settle))))
(do
(adv!)
(let
((tgt (cond ((at-end?) nil) ((and (= (tp-type) "keyword") (or (= (tp-val) "then") (= (tp-val) "end") (= (tp-val) "with") (= (tp-val) "when") (= (tp-val) "on"))) nil) (true (parse-expr)))))
(if
(nil? tgt)
(list (quote settle))
(list (quote settle) tgt)))))
((and (= typ "keyword") (= val "go"))
(do (adv!) (parse-go-cmd)))
((and (= typ "keyword") (= val "return"))
@@ -2716,9 +2739,11 @@
(adv!)
(expect-kw! "view")
(expect-kw! "transition")
(let ((using (if (match-kw "using") (parse-expr) nil)))
(let
((using (if (match-kw "using") (parse-expr) nil)))
(match-kw "then")
(let ((body (parse-cmd-list)))
(let
((body (parse-cmd-list)))
(match-kw "end")
(list (quote view-transition!) using body)))))
(true (parse-expr))))))
@@ -2882,7 +2907,11 @@
(true nil))))
(true nil))))
(consume-having!)
(when (and (= (tp-type) "keyword") (= (tp-val) "queue")) (do (adv!) (adv!)))
(when
(and
(= (tp-type) "keyword")
(= (tp-val) "queue"))
(do (adv!) (adv!)))
(let
((having (if (or h-margin h-threshold) (dict "margin" h-margin "threshold" h-threshold) nil)))
(let