js-on-sx: bitwise ops & | ^ << >> (+ compound assigns)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s

This commit is contained in:
2026-05-08 17:10:57 +00:00
parent ee422f3d15
commit a8d0dfb38a
3 changed files with 79 additions and 0 deletions

View File

@@ -303,6 +303,16 @@
(js-sym "js-unsigned-rshift")
(js-transpile l)
(js-transpile r)))
((= op "<<")
(list (js-sym "js-shl") (js-transpile l) (js-transpile r)))
((= op ">>")
(list (js-sym "js-shr") (js-transpile l) (js-transpile r)))
((= op "&")
(list (js-sym "js-bitand") (js-transpile l) (js-transpile r)))
((= op "|")
(list (js-sym "js-bitor") (js-transpile l) (js-transpile r)))
((= op "^")
(list (js-sym "js-bitxor") (js-transpile l) (js-transpile r)))
(else (error (str "js-transpile-binop: unsupported op: " op))))))
;; ── Object literal ────────────────────────────────────────────────
@@ -674,6 +684,12 @@
(list (js-sym "js-undefined?") lhs-expr))
rhs-expr
lhs-expr))
((= op "<<=") (list (js-sym "js-shl") lhs-expr rhs-expr))
((= op ">>=") (list (js-sym "js-shr") lhs-expr rhs-expr))
((= op ">>>=") (list (js-sym "js-unsigned-rshift") lhs-expr rhs-expr))
((= op "&=") (list (js-sym "js-bitand") lhs-expr rhs-expr))
((= op "|=") (list (js-sym "js-bitor") lhs-expr rhs-expr))
((= op "^=") (list (js-sym "js-bitxor") lhs-expr rhs-expr))
(else (error (str "js-compound-update: unsupported op: " op))))))
(define