js-on-sx: var hoisting — hoist var names as undefined before funcdecls
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-25 12:18:42 +00:00
parent f16e1b69c0
commit 11315d91cc
2 changed files with 62 additions and 3 deletions

View File

@@ -1333,6 +1333,15 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 4203)
(eval "(let ((toks (js-tokenize \"a b\"))) (get (nth toks 1) :nl))")
(epoch 4300)
(eval "(js-eval \"var x = 5; x\")")
(epoch 4301)
(eval "(js-eval \"function f() { return x; var x = 42; } f()\")")
(epoch 4302)
(eval "(js-eval \"function f() { var y = 7; return y; } f()\")")
(epoch 4303)
(eval "(js-eval \"function f() { var z; z = 3; return z; } f()\")")
EPOCHS
@@ -2058,6 +2067,11 @@ check 4201 "return+space+val → val" '42'
check 4202 "nl-before flag set after newline" 'true'
check 4203 "nl-before flag false on same line" 'false'
check 4300 "var decl program-level" '5'
check 4301 "var hoisted before use → undef" '"js-undefined"'
check 4302 "var in function body" '7'
check 4303 "var then set in function" '3'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "$PASS/$TOTAL JS-on-SX tests passed"