Skip to content

Commit

Permalink
fix #30048, lowering gc_preserve of closure variables
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Nov 16, 2018
1 parent 604046c commit 5d2f5e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3893,8 +3893,9 @@ f(x) = yt(x)
'(null))

((gc_preserve_begin)
(let ((s (make-ssavalue)))
(emit `(= ,s ,e))
(let ((s (make-ssavalue))
(args (compile-args (cdr e) break-labels linearize-args)))
(emit `(= ,s ,(cons (car e) args)))
s))

;; metadata expressions
Expand Down
15 changes: 15 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,21 @@ end
# we don't parse chains of these since the associativity and meaning aren't clear
@test_throws ParseError Meta.parse("1..2..3")

# issue #30048
@test Meta.isexpr(Meta.lower(@__MODULE__, :(for a in b
c = try
try
d() do
if GC.@preserve c begin
end
end
end
finally
end
finally
end
end)), :thunk)

# issue #28506
@test Meta.isexpr(Meta.parse("1,"), :incomplete)
@test Meta.isexpr(Meta.parse("1, "), :incomplete)
Expand Down

0 comments on commit 5d2f5e1

Please sign in to comment.