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
3 changes: 2 additions & 1 deletion JuliaSyntax/src/integration/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,9 @@ end
elseif k == K"function"
if length(args) > 1
if has_flags(nodehead, SHORT_FORM_FUNCTION_FLAG)
a1 = args[1]
a2 = args[2]
if !@isexpr(a2, :block)
if !@isexpr(a2, :block) && !@isexpr(a1, Symbol("'"))
args[2] = Expr(:block, a2)
end
retexpr.head = :(=)
Expand Down
6 changes: 6 additions & 0 deletions JuliaSyntax/test/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@
Expr(:block,
LineNumberNode(3)))

# short-form postfix function shouldn't introduce a block
@test parsestmt("x' = 1") ==
Expr(:(=),
Expr(Symbol("'"), :x),
1)

# `.=` doesn't introduce short form functions
@test parsestmt("f() .= xs") ==
Expr(:(.=), Expr(:call, :f), :xs)
Expand Down