Skip to content

Commit

Permalink
fix #32467, parsing macro on for inside do inside call (#32476)
Browse files Browse the repository at this point in the history
(cherry picked from commit b74ef05)
  • Loading branch information
JeffBezanson committed Jul 16, 2019
1 parent 8dd88f3 commit aa79ae4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,6 @@
`(with-bindings ((whitespace-newline #t))
,@body))

(define-macro (without-whitespace-newline . body)
`(with-bindings ((whitespace-newline #f))
,@body))

;; --- lexer ---

(define (newline? c) (eqv? c #\newline))
Expand Down Expand Up @@ -1546,7 +1542,7 @@
(define (parse-do s)
(with-bindings
((expect-end-current-line (input-port-line (ts:port s))))
(without-whitespace-newline
(with-normal-context
(let ((doargs (if (memv (peek-token s) '(#\newline #\;))
'()
(parse-comma-separated s parse-range))))
Expand Down
11 changes: 11 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1875,3 +1875,14 @@ x32499 = begin
S32499(x=2)
end
@test x32499 == 2

# issue #32467
let f = identity(identity() do
x = 0
@inbounds for i = 1:2
x += i
end
x
end)
@test f() == 3
end

0 comments on commit aa79ae4

Please sign in to comment.