Skip to content

Commit 1eae65b

Browse files
authored
syntax: deparse function end (#44630)
1 parent 28f58e7 commit 1eae65b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/ast.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
(cdr e)
178178
(list e)))
179179
(deparse-block (string (car e) " " (deparse (cadr e)))
180-
(block-stmts (caddr e))
180+
(if (null? (cddr e)) '() (block-stmts (caddr e)))
181181
ilvl))
182182
((return) (string "return " (deparse (cadr e))))
183183
((break continue) (string (car e)))

test/syntax.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,14 @@ invalid assignment location "function (s, o...)
14521452
end\""""
14531453
end
14541454

1455+
let ex = Meta.lower(@__MODULE__, :(function g end = 1))
1456+
@test isa(ex, Expr) && ex.head === :error
1457+
@test ex.args[1] == """
1458+
invalid assignment location "function g
1459+
end\""""
1460+
end
1461+
1462+
14551463
# issue #15229
14561464
@test Meta.lower(@__MODULE__, :(function f(x); local x; 0; end)) ==
14571465
Expr(:error, "local variable name \"x\" conflicts with an argument")

0 commit comments

Comments
 (0)