Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4436,15 +4436,16 @@ f(x) = yt(x)
(define (pop-handler-list src-tokens dest-tokens lab)
(if (eq? src-tokens dest-tokens)
#f
(let loop ((s src-tokens)
(l '()))
(if (not (pair? s))
(if (null? lab)
(error "Attempt to jump into catch block")
(error (string "cannot goto label \"" lab "\" inside try/catch block"))))
(if (eq? (cdr s) dest-tokens)
(cons (car s) l)
(loop (cdr s) (cons (car s) l))))))
(reverse
(let loop ((s src-tokens)
(l '()))
(if (not (pair? s))
(if (null? lab)
(error "Attempt to jump into catch block")
(error (string "cannot goto label \"" lab "\" inside try/catch block"))))
(if (eq? (cdr s) dest-tokens)
(cons (car s) l)
(loop (cdr s) (cons (car s) l)))))))
(define (emit-return tail x)
(define (emit- x)
(let* ((tmp (if ((if (null? catch-token-stack) valid-ir-return? simple-atom?) x)
Expand Down
23 changes: 23 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3865,6 +3865,29 @@ end
end
end

let src = Meta.@lower let
try
try
return 1
catch
end
finally
nothing
end
end
code = src.args[1].code
for stmt in code
if Meta.isexpr(stmt, :leave) && length(stmt.args) > 1
# Expr(:leave, ...) should list the arguments to pop from
# inner-most scope to outer-most
@test issorted(Int[
(arg::Core.SSAValue).id
for arg in stmt.args
]; rev=true)
end
end
end

# Test that globals can be `using`'d even if they are not yet defined
module UndefGlobal54954
global theglobal54954::Int
Expand Down
Loading