This commit is contained in:
2026-06-08 13:21:57 +02:00
parent 823130e3ac
commit 8bee76328b
23 changed files with 734 additions and 382 deletions
+8
View File
@@ -108,6 +108,13 @@
[(_ obj field) (string-append (js1 obj) "." (js-id field))]
[(_ obj field rest ...) (js-dot* (js-dot* obj field) rest ...)]))
(define-syntax js-ref*
(syntax-rules ()
[(_ obj key) (string-append (js1 obj) "[" (js1 key) "]")]
[(_ obj key rest ...)
(string-append (js-ref* obj key)
(string-append "[" (js1 rest) "]") ...)]))
(define-syntax js-send
(syntax-rules ()
[(_ obj method) (string-append (js1 obj) "." (js-id method) "()")]
@@ -295,6 +302,7 @@
[(eq? d 'list) #'(js-array arg ...)]
[(eq? d 'cons) #'(js-cons arg ...)]
[(or (eq? d 'js-dot) (eq? d 'dot)) #'(js-dot* arg ...)]
[(eq? d 'js-ref) #'(js-ref* arg ...)]
[(eq? d 'new) #'(js-new arg ...)]
[(identifier? #'op) #'(js-call op arg ...)]
[else (raise-syntax-error 'js1 "unsupported compound expression" stx #'op)]))]