Skip to content

Commit

Permalink
slightly more efficient lowering of destructuring assignment
Browse files Browse the repository at this point in the history
There is no need to fetch the next state after the last element.

(cherry picked from commit 446bc7a)
  • Loading branch information
JeffBezanson authored and KristofferC committed Sep 10, 2018
1 parent fd06f05 commit 447103c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1916,16 +1916,19 @@
(ssavalue? x))
x (make-ssavalue)))
(ini (if (eq? x xx) '() `((= ,xx ,(expand-forms x)))))
(n (length lhss))
(st (gensy)))
`(block
,@ini
,.(map (lambda (i lhs)
(expand-forms
(lower-tuple-assignment
(list lhs st)
(if (= i (- n 1))
(list lhs)
(list lhs st))
`(call (top indexed_iterate)
,xx ,(+ i 1) ,.(if (eq? i 0) '() `(,st))))))
(iota (length lhss))
(iota n)
lhss)
(unnecessary ,xx))))))
((typed_hcat)
Expand Down

0 comments on commit 447103c

Please sign in to comment.