|
1769 | 1769 | (args (map dot-to-fuse (cdr kws+args)))
|
1770 | 1770 | (make `(call (top ,(if (null? kws) 'broadcasted 'broadcasted_kwsyntax)) ,@kws ,f ,@args)))
|
1771 | 1771 | (if top (cons 'fuse make) make)))
|
1772 |
| - (if (and (length= e 3) (eq? (car e) '|.|)) |
1773 |
| - (let ((f (cadr e)) (x (caddr e))) |
1774 |
| - (cond ((or (atom? x) (eq? (car x) 'quote) (eq? (car x) 'inert) (eq? (car x) '$)) |
1775 |
| - `(call (top getproperty) ,f ,x)) |
1776 |
| - ((eq? (car x) 'tuple) |
1777 |
| - (if (and (eq? (identifier-name f) '^) (length= x 3) (integer? (caddr x))) |
1778 |
| - (make-fuse '(top literal_pow) |
1779 |
| - (list f (cadr x) (expand-forms `(call (call (core apply_type) (top Val) ,(caddr x)))))) |
1780 |
| - (make-fuse f (cdr x)))) |
1781 |
| - (else |
1782 |
| - (error (string "invalid syntax \"" (deparse e) "\""))))) |
1783 |
| - (if (and (pair? e) (eq? (car e) 'call)) |
1784 |
| - (begin |
1785 |
| - (define (make-fuse- f x) |
1786 |
| - (if (and (eq? (identifier-name f) '^) (length= x 2) (integer? (cadr x))) |
1787 |
| - (make-fuse '(top literal_pow) |
1788 |
| - (list f (car x) (expand-forms `(call (call (core apply_type) (top Val) ,(cadr x)))))) |
1789 |
| - (make-fuse f x))) |
1790 |
| - (let ((f (cadr e))) |
1791 |
| - (cond ((dotop-named? f) |
1792 |
| - (make-fuse- (undotop f) (cddr e))) |
1793 |
| - ;; (.+)(a, b) is parsed as (call (|.| +) a b), but we still want it to fuse |
1794 |
| - ((and (length= f 2) (eq? (car f) '|.|)) |
1795 |
| - (make-fuse- (cadr f) (cddr e))) |
1796 |
| - (else |
1797 |
| - e)))) |
1798 |
| - e))) |
| 1772 | + (cond ((and (length= e 3) (eq? (car e) '|.|)) |
| 1773 | + (let ((f (cadr e)) (x (caddr e))) |
| 1774 | + (cond ((or (atom? x) (eq? (car x) 'quote) (eq? (car x) 'inert) (eq? (car x) '$)) |
| 1775 | + `(call (top getproperty) ,f ,x)) |
| 1776 | + ((eq? (car x) 'tuple) |
| 1777 | + (if (and (eq? (identifier-name f) '^) (length= x 3) (integer? (caddr x))) |
| 1778 | + (make-fuse '(top literal_pow) |
| 1779 | + (list f (cadr x) (expand-forms `(call (call (core apply_type) (top Val) ,(caddr x)))))) |
| 1780 | + (make-fuse f (cdr x)))) |
| 1781 | + (else |
| 1782 | + (error (string "invalid syntax \"" (deparse e) "\"")))))) |
| 1783 | + ((and (pair? e) (eq? (car e) 'call)) |
| 1784 | + (define (make-fuse- f x) |
| 1785 | + (if (and (eq? (identifier-name f) '^) (length= x 2) (integer? (cadr x))) |
| 1786 | + (make-fuse '(top literal_pow) |
| 1787 | + (list f (car x) (expand-forms `(call (call (core apply_type) (top Val) ,(cadr x)))))) |
| 1788 | + (make-fuse f x))) |
| 1789 | + (let ((f (cadr e))) |
| 1790 | + (cond ((dotop-named? f) |
| 1791 | + (make-fuse- (undotop f) (cddr e))) |
| 1792 | + ;; (.+)(a, b) is parsed as (call (|.| +) a b), but we still want it to fuse |
| 1793 | + ((and (length= f 2) (eq? (car f) '|.|)) |
| 1794 | + (make-fuse- (cadr f) (cddr e))) |
| 1795 | + (else |
| 1796 | + e)))) |
| 1797 | + ((and (pair? e) (eq? (car e) 'comparison)) |
| 1798 | + (dot-to-fuse (expand-compare-chain (cdr e)) top)) |
| 1799 | + (else e))) |
1799 | 1800 | (let ((e (dot-to-fuse rhs #t)) ; an expression '(fuse func args) if expr is a dot call
|
1800 | 1801 | (lhs-view (ref-to-view lhs))) ; x[...] expressions on lhs turn in to view(x, ...) to update x in-place
|
1801 | 1802 | (if (fuse? e)
|
|
0 commit comments