mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-11 06:47:37 +02:00
Add missing commas
This commit is contained in:
parent
9545200722
commit
62b44d667a
1 changed files with 18 additions and 2 deletions
|
@ -693,6 +693,13 @@
|
||||||
(and (prim? exp)
|
(and (prim? exp)
|
||||||
(member exp '())))
|
(member exp '())))
|
||||||
|
|
||||||
|
;; Does string end with the given substring?
|
||||||
|
;; EG: ("test(" "(") ==> #t
|
||||||
|
(define (str-ending? str end)
|
||||||
|
(let ((len (string-length str)))
|
||||||
|
(and (> len 0)
|
||||||
|
(equal? end (substring str (- len 1) len)))))
|
||||||
|
|
||||||
;; c-compile-prim : prim-exp -> string -> string
|
;; c-compile-prim : prim-exp -> string -> string
|
||||||
(define (c-compile-prim p cont)
|
(define (c-compile-prim p cont)
|
||||||
(let* ((c-func (prim->c-func p))
|
(let* ((c-func (prim->c-func p))
|
||||||
|
@ -847,7 +854,8 @@
|
||||||
;; Add a comma if there were any args to the func
|
;; Add a comma if there were any args to the func
|
||||||
(let* ((fnc-str (car (c:allocs c-fun)))
|
(let* ((fnc-str (car (c:allocs c-fun)))
|
||||||
(len (string-length fnc-str)))
|
(len (string-length fnc-str)))
|
||||||
(write (string-append "(JAE-DEBUG " fnc-str))
|
;(write (string-append "(JAE-DEBUG " fnc-str))
|
||||||
|
TODO: rewrite cond below in terms of (str-ending?)
|
||||||
(cond
|
(cond
|
||||||
((and (> len 0)
|
((and (> len 0)
|
||||||
(not (equal? "("
|
(not (equal? "("
|
||||||
|
@ -858,7 +866,15 @@
|
||||||
(c:body c-args*) ");"))))
|
(c:body c-args*) ");"))))
|
||||||
;; Args stay with body
|
;; Args stay with body
|
||||||
(c:append
|
(c:append
|
||||||
(c:append c-fun c-args*)
|
(c:append
|
||||||
|
(let ()
|
||||||
|
;(display "JAE DEBUG2: ")
|
||||||
|
;(write c-fun)
|
||||||
|
;; Add a comma if necessary
|
||||||
|
(if (str-ending? (c:body c-fun) "(")
|
||||||
|
c-fun
|
||||||
|
(c:append c-fun (c-code ", "))))
|
||||||
|
c-args*)
|
||||||
(c-code ")")))))
|
(c-code ")")))))
|
||||||
|
|
||||||
((equal? '%closure-ref fun)
|
((equal? '%closure-ref fun)
|
||||||
|
|
Loading…
Add table
Reference in a new issue