Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add do in front-end deparser. fixes #17781 #26840

Merged
merged 1 commit into from
Apr 18, 2018
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
7 changes: 7 additions & 0 deletions src/ast.scm
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@
""))
"")
(string.rep " " ilvl) "end"))
((do)
(let ((call (cadr e))
(args (cdr (cadr (caddr e))))
(body (caddr (caddr e))))
(deparse-block (string (deparse call) " do" (if (null? args) "" " ")
(deparse-arglist args))
(cdr body) ilvl)))
((struct)
(string (if (eq? (cadr e) 'true) "mutable " "")
"struct "
Expand Down
20 changes: 20 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1386,3 +1386,23 @@ end

# issue #26717
@test Meta.lower(@__MODULE__, :( :(:) = 2 )) == Expr(:error, "invalid assignment location \":(:)\"")

# issue #17781
let ex = Meta.lower(@__MODULE__, Meta.parse("
A = function (s, o...)
f(a, b) do
end
end,
B = function (s, o...)
f(a, b) do
end
end"))
@test isa(ex, Expr) && ex.head === :error
@test ex.args[1] == """
invalid assignment location "function (s, o...)
# none, line 3
f(a, b) do
# none, line 4
end
end\""""
end