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.
  • Loading branch information
JeffBezanson authored and Keno committed Sep 8, 2018
1 parent f922a63 commit 3057ebc
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 3057ebc

Please sign in to comment.