|
472 | 472 | `((|::|
|
473 | 473 | ;; if there are optional positional args, we need to be able to reference the function name
|
474 | 474 | ,(if (any kwarg? pargl) (gensy) UNUSED)
|
475 |
| - (call (core kwftype) ,ftype)) (:: ,kw (core AnyVector)) ,@pargl ,@vararg) |
| 475 | + (call (core kwftype) ,ftype)) ,kw ,@pargl ,@vararg) |
476 | 476 | `(block
|
477 | 477 | ;; initialize keyword args to their defaults, or set a flag telling
|
478 | 478 | ;; whether this keyword needs to be set.
|
|
486 | 486 | flags)
|
487 | 487 | ,@(if (null? restkw) '()
|
488 | 488 | `((= ,rkw (top EmptyKWDict))))
|
| 489 | + ,(if (and (not (null? restkw)) (null? keynames)) |
| 490 | + `(if (call (core isa) ,kw (top KWDict)) |
| 491 | + (block |
| 492 | + (= ,rkw ,kw) ;; reuse kwarg list for delegation if possible |
| 493 | + (symbolicgoto do_call))) |
| 494 | + `(if (call (core isa) ,kw (top KWDict)) |
| 495 | + (= ,kw (call (top collect_as_kwargs) ,kw)))) |
489 | 496 | ;; for i = 1:(length(kw)>>1)
|
490 | 497 | (for (= ,i (: (call (top >>) (call (top length) ,kw) 1) -1 1))
|
491 | 498 | (block
|
|
546 | 553 | '()
|
547 | 554 | `((if ,flag (= ,name ,dflt)))))
|
548 | 555 | keynames vals flags))
|
| 556 | + (symboliclabel do_call) |
549 | 557 | ;; finally, call the core function
|
550 | 558 | (return (call ,mangled
|
551 | 559 | ,@keynames
|
|
0 commit comments