|
2105 | 2105 | `(call ,@hvncat ,dims ,(tf is-row-first) ,@aflat)) |
2106 | 2106 | `(call ,@hvncat ,(tuplize shape) ,(tf is-row-first) ,@aflat)))))))) |
2107 | 2107 |
|
2108 | | -(define (expand-property-destruct lhss x) |
2109 | | - (if (not (length= lhss 1)) |
2110 | | - (error (string "invalid assignment location \"" (deparse lhs) "\""))) |
2111 | | - (let* ((xx (if (symbol-like? x) x (make-ssavalue))) |
2112 | | - (ini (if (eq? x xx) '() (list (sink-assignment xx (expand-forms x)))))) |
| 2108 | +(define (maybe-ssavalue lhss x in-lhs?) |
| 2109 | + (cond ((or (and (not (in-lhs? x lhss)) (symbol? x)) |
| 2110 | + (ssavalue? x)) |
| 2111 | + x) |
| 2112 | + ((and (pair? lhss) (vararg? (last lhss)) |
| 2113 | + (eventually-call? (cadr (last lhss)))) |
| 2114 | + (gensy)) |
| 2115 | + (else (make-ssavalue)))) |
| 2116 | + |
| 2117 | +(define (expand-property-destruct lhs x) |
| 2118 | + (if (not (length= lhs 1)) |
| 2119 | + (error (string "invalid assignment location \"" (deparse `(tuple ,lhs)) "\""))) |
| 2120 | + (let* ((lhss (cdar lhs)) |
| 2121 | + (xx (maybe-ssavalue lhss x memq)) |
| 2122 | + (ini (if (eq? x xx) '() (list (sink-assignment xx (expand-forms x)))))) |
2113 | 2123 | `(block |
2114 | 2124 | ,@ini |
2115 | 2125 | ,@(map |
|
2118 | 2128 | ((and (pair? field) (eq? (car field) '|::|) (symbol? (cadr field))) |
2119 | 2129 | (cadr field)) |
2120 | 2130 | (else |
2121 | | - (error (string "invalid assignment location \"" (deparse lhs) "\"")))))) |
| 2131 | + (error (string "invalid assignment location \"" (deparse `(tuple ,lhs)) "\"")))))) |
2122 | 2132 | (expand-forms `(= ,field (call (top getproperty) ,xx (quote ,prop)))))) |
2123 | | - (cdar lhss)) |
| 2133 | + lhss) |
2124 | 2134 | (unnecessary ,xx)))) |
2125 | 2135 |
|
2126 | 2136 | (define (expand-tuple-destruct lhss x) |
|
2153 | 2163 | ((eq? l x) #t) |
2154 | 2164 | (else (in-lhs? x (cdr lhss))))))) |
2155 | 2165 | ;; in-lhs? also checks for invalid syntax, so always call it first |
2156 | | - (let* ((xx (cond ((or (and (not (in-lhs? x lhss)) (symbol? x)) |
2157 | | - (ssavalue? x)) |
2158 | | - x) |
2159 | | - ((and (pair? lhss) (vararg? (last lhss)) |
2160 | | - (eventually-call? (cadr (last lhss)))) |
2161 | | - (gensy)) |
2162 | | - (else (make-ssavalue)))) |
| 2166 | + (let* ((xx (maybe-ssavalue lhss x in-lhs?)) |
2163 | 2167 | (ini (if (eq? x xx) '() (list (sink-assignment xx (expand-forms x))))) |
2164 | 2168 | (n (length lhss)) |
2165 | 2169 | ;; skip last assignment if it is an all-underscore vararg |
|
0 commit comments