|
2036 | 2036 | (- n 1)
|
2037 | 2037 | n))
|
2038 | 2038 | n))
|
2039 |
| - (st (gensy))) |
| 2039 | + (st (gensy)) |
| 2040 | + (end '())) |
2040 | 2041 | `(block
|
2041 | 2042 | ,@(if (> n 0) `((local ,st)) '())
|
2042 | 2043 | ,@ini
|
2043 | 2044 | ,@(map (lambda (i lhs)
|
2044 |
| - (expand-forms |
2045 |
| - (if (vararg? lhs) |
2046 |
| - `(= ,(cadr lhs) (call (top rest) ,xx ,@(if (eq? i 0) '() `(,st)))) |
2047 |
| - (lower-tuple-assignment |
2048 |
| - (if (= i (- n 1)) |
2049 |
| - (list lhs) |
2050 |
| - (list lhs st)) |
2051 |
| - `(call (top indexed_iterate) |
2052 |
| - ,xx ,(+ i 1) ,@(if (eq? i 0) '() `(,st))))))) |
| 2045 | + (let ((lhs- (cond ((or (symbol? lhs) (ssavalue? lhs)) |
| 2046 | + lhs) |
| 2047 | + ((vararg? lhs) |
| 2048 | + (let ((lhs- (cadr lhs))) |
| 2049 | + (if (or (symbol? lhs-) (ssavalue? lhs-)) |
| 2050 | + lhs |
| 2051 | + `(|...| ,(if (eventually-call? lhs-) |
| 2052 | + (gensy) |
| 2053 | + (make-ssavalue)))))) |
| 2054 | + ;; can't use ssavalues if it's a function definition |
| 2055 | + ((eventually-call? lhs) (gensy)) |
| 2056 | + (else (make-ssavalue))))) |
| 2057 | + (if (not (eq? lhs lhs-)) |
| 2058 | + (if (vararg? lhs) |
| 2059 | + (set! end (cons (expand-forms `(= ,(cadr lhs) ,(cadr lhs-))) end)) |
| 2060 | + (set! end (cons (expand-forms `(= ,lhs ,lhs-)) end)))) |
| 2061 | + (expand-forms |
| 2062 | + (if (vararg? lhs-) |
| 2063 | + `(= ,(cadr lhs-) (call (top rest) ,xx ,@(if (eq? i 0) '() `(,st)))) |
| 2064 | + (lower-tuple-assignment |
| 2065 | + (if (= i (- n 1)) |
| 2066 | + (list lhs-) |
| 2067 | + (list lhs- st)) |
| 2068 | + `(call (top indexed_iterate) |
| 2069 | + ,xx ,(+ i 1) ,@(if (eq? i 0) '() `(,st)))))))) |
2053 | 2070 | (iota n)
|
2054 | 2071 | lhss)
|
| 2072 | + ,@(reverse end) |
2055 | 2073 | (unnecessary ,xx))))))
|
2056 | 2074 |
|
2057 | 2075 | ;; move an assignment into the last statement of a block to keep more statements at top level
|
|
0 commit comments