From 59bc75439c91d90c9379e13968850da63b79f0c9 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Sat, 28 May 2016 00:53:23 -0400 Subject: [PATCH] fix to generator lowering make sure it introduces new variables --- src/julia-syntax.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 95758848058fe..1cccdeb54c689 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -1998,8 +1998,12 @@ (car vars) (gensy))) (splat (cond ((eq? argname (car vars)) '()) - ((length= vars 1) `((= ,(car vars) ,argname))) - (else `((= (tuple ,@vars) ,argname)))))) + ((length= vars 1) + `(,@(map (lambda (v) `(local ,v)) (lhs-vars (car vars))) + (= ,(car vars) ,argname))) + (else + `(,@(map (lambda (v) `(local ,v)) (lhs-vars `(tuple ,@vars))) + (= (tuple ,@vars) ,argname)))))) (expand-forms `(call (top Generator) (-> ,argname (block ,@splat ,expr)) ,(if (length= ranges 1)