js-on-sx: delete operator

js-transpile-unop intercepts 'delete' before transpiling the
operand. Maps to (js-delete-prop obj key) for members and indexed
access. Runtime js-delete-prop sets the dict value to js-undefined
and returns true.

444/446 unit (+2), 148/148 slice unchanged.
This commit is contained in:
2026-04-23 23:34:05 +00:00
parent 27bd25843e
commit 6293a0fe70
3 changed files with 44 additions and 10 deletions

View File

@@ -1825,6 +1825,15 @@
(define Object {:entries js-object-entries :values js-object-values :freeze js-object-freeze :assign js-object-assign :keys js-object-keys})
(define
js-delete-prop
(fn
(obj key)
(cond
((dict? obj)
(begin (dict-set! obj (js-to-string key) js-undefined) true))
(else true))))
(define
js-optchain-get
(fn