js-on-sx: typeof <ident> returns "undefined" for unresolvable references
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s

This commit is contained in:
2026-05-09 08:04:21 +00:00
parent 5632830118
commit 21d0be58ec
2 changed files with 16 additions and 0 deletions

View File

@@ -225,6 +225,20 @@
(js-transpile (nth arg 1))
(js-transpile (nth arg 2))))
(else true)))
((and (= op "typeof") (js-tag? arg "js-ident"))
(let
((name (nth arg 1)))
(list
(js-sym "if")
(list
(js-sym "or")
(list
(js-sym "env-has?")
(list (js-sym "current-env"))
name)
(list (js-sym "dict-has?") (js-sym "js-global") name))
(list (js-sym "js-typeof") (js-transpile arg))
"undefined")))
(else
(let
((a (js-transpile arg)))