|
289 | 289 | (rec-desugar value)] |
290 | 290 | [target-id (new-id)]) |
291 | 291 | (if (eq? dsg-subscript-assignment true) |
292 | | - (py-app (py-getfield desugared-target '__setitem__) |
| 292 | + (py-method (py-getfield desugared-target '__setitem__) |
293 | 293 | (list |
294 | 294 | desugared-slice |
295 | 295 | desugared-value) |
296 | | -(none)) |
| 296 | + ) |
297 | 297 | ; if flag is off |
298 | 298 | (CLet '$call (LocalId) |
299 | 299 | (py-getfield desugared-target '__setitem__) |
|
311 | 311 | (define assigns |
312 | 312 | (if (eq? dsg-multiple-assignment true) |
313 | 313 | (map2 (λ (t n) |
314 | | - (CAssign t (py-app |
| 314 | + (CAssign t (py-method |
315 | 315 | (py-getfield (CId '$tuple_result (LocalId)) |
316 | 316 | '__getitem__) |
317 | 317 | (list (make-builtin-num n)) |
318 | | -(none)))) |
| 318 | + ))) |
319 | 319 | targets-r |
320 | 320 | (build-list (length targets-r) identity)) |
321 | 321 | ; if flag is false |
|
374 | 374 | (if (eq? dsg-raise true) |
375 | 375 | (rec-desugar (LexApp expr (list) (list) (none) (none))) |
376 | 376 | (CLet '$call (LocalId) (rec-desugar expr) |
377 | | - (simple-apply-method (py-getfield (CId '$call (LocalId)) '__call__) (list) ))) |
| 377 | + (py-method (py-getfield (CId '$call (LocalId)) '__call__) (list) ))) |
378 | 378 | (rec-desugar expr)))] |
379 | 379 | (CRaise |
380 | 380 | (if (LexPass? expr) |
|
406 | 406 | (define right-r (rec-desugar right)) |
407 | 407 | (define right-c right-r)] |
408 | 408 | (case op |
409 | | - ['Add (py-app (py-getfield left-c '__add__) |
| 409 | + ['Add (py-method (py-getfield left-c '__add__) |
410 | 410 | (list right-c) |
411 | | -(none))] |
412 | | - ['Sub (py-app (py-getfield left-c '__sub__) |
| 411 | + )] |
| 412 | + ['Sub (py-method (py-getfield left-c '__sub__) |
413 | 413 | (list right-c) |
414 | | -(none))] |
415 | | - ['Mult (py-app (py-getfield left-c '__mult__) |
| 414 | + )] |
| 415 | + ['Mult (py-method (py-getfield left-c '__mult__) |
416 | 416 | (list right-c) |
417 | | -(none))] |
418 | | - ['Pow (py-app (py-getfield left-c '__pow__) |
| 417 | + )] |
| 418 | + ['Pow (py-method (py-getfield left-c '__pow__) |
419 | 419 | (list right-c) |
420 | | -(none))] |
421 | | - ['Div (py-app (py-getfield left-c '__div__) |
| 420 | + )] |
| 421 | + ['Div (py-method (py-getfield left-c '__div__) |
422 | 422 | (list right-c) |
423 | | -(none))] |
424 | | - ['FloorDiv (py-app (py-getfield left-c '__floordiv__) |
| 423 | + )] |
| 424 | + ['FloorDiv (py-method (py-getfield left-c '__floordiv__) |
425 | 425 | (list right-c) |
426 | | -(none))] |
427 | | - ['Mod (py-app (py-getfield left-c '__mod__) |
| 426 | + )] |
| 427 | + ['Mod (py-method (py-getfield left-c '__mod__) |
428 | 428 | (list right-c) |
429 | | -(none))] |
430 | | - ['BitAnd (py-app (py-getfield left-c '__and__) |
| 429 | + )] |
| 430 | + ['BitAnd (py-method (py-getfield left-c '__and__) |
431 | 431 | (list right-c) |
432 | | -(none))] |
433 | | - ['BitOr (py-app (py-getfield left-c '__or__) |
| 432 | + )] |
| 433 | + ['BitOr (py-method (py-getfield left-c '__or__) |
434 | 434 | (list right-c) |
435 | | -(none))] |
436 | | - ['BitXor (py-app (py-getfield left-c '__xor__) |
| 435 | + )] |
| 436 | + ['BitXor (py-method (py-getfield left-c '__xor__) |
437 | 437 | (list right-c) |
438 | | -(none))] |
439 | | - ['LShift (py-app (py-getfield left-c '__lshift__) |
| 438 | + )] |
| 439 | + ['LShift (py-method (py-getfield left-c '__lshift__) |
440 | 440 | (list right-c) |
441 | | -(none))] |
442 | | - ['RShift (py-app (py-getfield left-c '__rshift__) |
| 441 | + )] |
| 442 | + ['RShift (py-method (py-getfield left-c '__rshift__) |
443 | 443 | (list right-c) |
444 | | -(none))] |
445 | | - ['Eq (py-app (py-getfield left-c '__eq__) |
| 444 | + )] |
| 445 | + ['Eq (py-method (py-getfield left-c '__eq__) |
446 | 446 | (list right-c) |
447 | | -(none))] |
448 | | - ['Gt (py-app (py-getfield left-c '__gt__) |
| 447 | + )] |
| 448 | + ['Gt (py-method (py-getfield left-c '__gt__) |
449 | 449 | (list right-c) |
450 | | -(none))] |
451 | | - ['Lt (py-app (py-getfield left-c '__lt__) |
| 450 | + )] |
| 451 | + ['Lt (py-method (py-getfield left-c '__lt__) |
452 | 452 | (list right-c) |
453 | | -(none))] |
454 | | - ['LtE (py-app (py-getfield left-c '__lte__) |
| 453 | + )] |
| 454 | + ['LtE (py-method (py-getfield left-c '__lte__) |
455 | 455 | (list right-c) |
456 | | -(none))] |
457 | | - ['GtE (py-app (py-getfield left-c '__gte__) |
| 456 | + )] |
| 457 | + ['GtE (py-method (py-getfield left-c '__gte__) |
458 | 458 | (list right-c) |
459 | | -(none))] |
| 459 | + )] |
460 | 460 | ['NotEq (rec-desugar (LexUnaryOp 'Not (LexBinOp left 'Eq right)))] |
461 | 461 | ['In (CApp (CFunc (list 'container'test) (none) |
462 | 462 | (CLet '__infunc__ (LocalId) |
463 | 463 | (py-getfield (CId 'container (LocalId)) |
464 | 464 | '__in__) |
465 | 465 | (CIf (CId '__infunc__ (LocalId)) |
466 | 466 | (CReturn |
467 | | - (py-app |
| 467 | + (py-method |
468 | 468 | (CId '__infunc__ (LocalId)) |
469 | 469 | (list |
470 | 470 | (CId 'test (LocalId))) |
471 | | -(none))) |
| 471 | + )) |
472 | 472 | (CRaise (some |
473 | 473 | (make-exception 'TypeError |
474 | 474 | (string-append |
|
486 | 486 | ['USub (rec-desugar (LexBinOp (LexNum 0) 'Sub operand))] |
487 | 487 | ['UAdd (rec-desugar (LexBinOp (LexNum 0) 'Add operand))] |
488 | 488 | ['Invert (local [(define roperand (rec-desugar operand))] |
489 | | - (py-app (py-getfield roperand '__invrt__) |
| 489 | + (py-method (py-getfield roperand '__invrt__) |
490 | 490 | (list) |
491 | | -(none)))] |
| 491 | + ))] |
492 | 492 | [else (CBuiltinPrim op (list (rec-desugar operand)))])] |
493 | 493 |
|
494 | 494 | [LexBoolOp (op values) (desugar-boolop op values)] |
|
554 | 554 | (CLet left-id |
555 | 555 | (LocalId) |
556 | 556 | left-r |
557 | | - (py-app (py-getfield left-var |
| 557 | + (py-method (py-getfield left-var |
558 | 558 | '__slice__) |
559 | 559 |
|
560 | 560 | (list slice-low |
561 | 561 | slice-up slice-step) |
562 | | -(none)))) |
| 562 | + ))) |
563 | 563 | (local [(define slice-r (rec-desugar slice)) |
564 | 564 | (define exn-id (new-id))] |
565 | 565 | (CLet left-id |
|
576 | 576 | 'TypeError |
577 | 577 | "object is not subscriptable")))) |
578 | 578 | (CNone)) |
579 | | - (py-app (py-getfield (CId left-id (LocalId)) |
| 579 | + (py-method (py-getfield (CId left-id (LocalId)) |
580 | 580 | '__getitem__) |
581 | 581 | (list slice-r) |
582 | | -(none);TODO: not sure what to do with stararg. |
| 582 | +;TODO: not sure what to do with stararg. |
583 | 583 | ))))))] |
584 | 584 | [(symbol=? ctx 'Load) ; flag is false |
585 | 585 | (local [(define left-id (new-id)) |
|
590 | 590 | (define slice-up (rec-desugar (LexSlice-upper slice))) |
591 | 591 | (define slice-step (rec-desugar (LexSlice-step slice)))] |
592 | 592 | (CLet left-id (LocalId) left-r |
593 | | - (simple-apply-method (py-getfield left-var '__slice__) |
| 593 | + (py-method (py-getfield left-var '__slice__) |
594 | 594 | (list slice-low slice-up slice-step)))) |
595 | 595 | (let ((slice-r (rec-desugar slice))) |
596 | 596 | (CLet left-id (LocalId) left-r |
597 | | - (simple-apply-method (py-getfield left-var '__getitem__) |
| 597 | + (py-method (py-getfield left-var '__getitem__) |
598 | 598 | (list slice-r)))))) |
599 | 599 | ] |
600 | 600 | [(symbol=? ctx 'Store) |
|
761 | 761 | [target-id (new-id)] |
762 | 762 | [target-var (CId target-id (LocalId))]) |
763 | 763 | (CLet target-id (LocalId) desugared-target |
764 | | - (py-app (py-getfield target-var |
| 764 | + (py-method (py-getfield target-var |
765 | 765 | '__delitem__) |
766 | 766 | (list |
767 | 767 | desugared-slice) |
768 | | -(none))))] |
| 768 | + )))] |
769 | 769 | [LexLocalId (x ctx) (rec-desugar |
770 | 770 | (LexAssign (list (LexLocalId x ctx)) (LexUndefined)))] |
771 | 771 | [LexGlobalId (x ctx) (rec-desugar |
|
0 commit comments