|
353 | 353 | (local [(define targets-r (map rec-desugar vals)) |
354 | 354 | (define value-r (rec-desugar value)) |
355 | 355 | (define assigns |
356 | | - (map2 (λ (t n) |
357 | | - (CAssign t (py-app |
358 | | - (py-getfield (CId '$tuple_result (LocalId)) |
359 | | -'__getitem__) |
360 | | - (list (make-builtin-num n)) |
361 | | - (none)))) |
362 | | - targets-r |
363 | | - (build-list (length targets-r) identity)))] |
364 | | - (if (eq? dsg-tuple-assignment true) |
365 | | - (CLet '$tuple_result (LocalId) value-r |
366 | | - (foldl (λ (a so-far) (CSeq so-far a)) |
367 | | - (first assigns) (rest assigns))) |
368 | | - (CAssign (CId '$tuple_result (LocalId)) (CNone))))] |
| 356 | + (if (eq? dsg-tuple-assignment true) |
| 357 | + (map2 (λ (t n) |
| 358 | + (CAssign t (py-app |
| 359 | + (py-getfield (CId '$tuple_result (LocalId)) |
| 360 | +'__getitem__) |
| 361 | + (list (make-builtin-num n)) |
| 362 | + (none)))) |
| 363 | + targets-r |
| 364 | + (build-list (length targets-r) identity)) |
| 365 | +; if flag is off |
| 366 | + (map2 (λ (t n) |
| 367 | + (CAssign t (CLet '$call (LocalId) |
| 368 | + (py-getfield (CId '$tuple_result (LocalId)) |
| 369 | +'__getitem__) |
| 370 | + (CSeq (CAssign (CId '$call (LocalId)) (py-getfield (CId '$call (LocalId)) '__call__)) |
| 371 | + (CApp (CBuiltinPrim 'obj-getattr (list (CId '$call (LocalId)) |
| 372 | + (make-builtin-str "__func__"))) |
| 373 | + (list (CBuiltinPrim 'obj-getattr (list (CId '$call (LocalId)) |
| 374 | + (make-builtin-str "__self__"))) |
| 375 | + (make-builtin-num n)) |
| 376 | + (none)))))) |
| 377 | + targets-r |
| 378 | + (build-list (length targets-r) identity)) |
| 379 | + ) |
| 380 | + |
| 381 | + |
| 382 | + )] |
| 383 | + (CLet '$tuple_result (LocalId) value-r |
| 384 | + (foldl (λ (a so-far) (CSeq so-far a)) |
| 385 | + (first assigns) (rest assigns))))] |
369 | 386 | ; The others become a CAssign. |
370 | 387 | [else |
371 | 388 | ; NOTE(joe): I think this was broken before for >1 target |
|
404 | 421 | ;handle the implicit construction case |
405 | 422 | (rec-desugar (LexApp expr (list) (list) (none) (none))) |
406 | 423 | (rec-desugar expr)))] |
407 | | - (if (eq? dsg-raise true) |
408 | | - (CRaise |
409 | | - (if (LexPass? expr) |
410 | | - (none) |
411 | | - (some expr-r))) |
412 | | - (CNone)))] |
| 424 | + (CRaise |
| 425 | + (if (LexPass? expr) |
| 426 | + (none) |
| 427 | + (some expr-r))))] |
413 | 428 |
|
414 | 429 | [LexYield (expr) (CYield (rec-desugar expr))] |
415 | 430 |
|
|
0 commit comments