|
229 | 229 | lst)))
|
230 | 230 |
|
231 | 231 | ;; get the name from a function formal argument expression, allowing `(escape x)`
|
232 |
| -(define (try-arg-name v) |
233 |
| - (cond ((symbol? v) (list v)) |
| 232 | +(define (try-arg-name v (escaped #f)) |
| 233 | + (cond ((symbol? v) (if escaped '() (list v))) |
234 | 234 | ((atom? v) '())
|
235 | 235 | (else
|
236 | 236 | (case (car v)
|
237 |
| - ((|::|) (if (length= v 2) '() (try-arg-name (cadr v)))) |
238 |
| - ((... kw =) (try-arg-name (cadr v))) |
239 |
| - ((escape) (list v)) |
240 |
| - ((hygienic-scope) (try-arg-name (cadr v))) |
| 237 | + ((|::|) (if (length= v 2) '() (try-arg-name (cadr v) escaped))) |
| 238 | + ((... kw =) (try-arg-name (cadr v) escaped)) |
| 239 | + ((escape) (if escaped (list (cadr v)) '())) |
| 240 | + ((hygienic-scope) (try-arg-name (cadr v) escaped)) |
| 241 | + ((tuple) (apply nconc (map (lambda (e) (try-arg-name e escaped)) (cdr v)))) |
241 | 242 | ((meta) ;; allow certain per-argument annotations
|
242 | 243 | (if (nospecialize-meta? v #t)
|
243 |
| - (try-arg-name (caddr v)) |
| 244 | + (try-arg-name (caddr v) escaped) |
244 | 245 | '()))
|
245 | 246 | (else '())))))
|
246 | 247 |
|
| 248 | +(define (is-escape? e) |
| 249 | + (and (pair? e) (eq? (car v) 'escape))) |
| 250 | + |
247 | 251 | ;; get names from a formal argument list, specifying whether to include escaped ones
|
248 | 252 | (define (safe-arg-names lst (escaped #f))
|
249 | 253 | (apply nconc
|
250 |
| - (map (lambda (v) |
251 |
| - (let ((vv (try-arg-name v))) |
252 |
| - (if (eq? escaped (and (pair? vv) (pair? (car vv)) (eq? (caar vv) 'escape))) |
253 |
| - (if escaped (list (cadar vv)) vv) |
254 |
| - '()))) |
255 |
| - lst))) |
| 254 | + (map (lambda (v) (try-arg-name v escaped)) lst))) |
256 | 255 |
|
257 | 256 | ;; arg names, looking only at positional args
|
258 | 257 | (define (safe-llist-positional-args lst (escaped #f))
|
|
0 commit comments