Skip to content

Commit 01847c4

Browse files
authored
Merge pull request #2107 from SciML/myb/clo
Use an anonymous function to avoid naming conflict in macro
2 parents d8ec38e + 1697470 commit 01847c4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/systems/abstractsystem.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,10 +1130,8 @@ function component_post_processing(expr, isconnector)
11301130

11311131
quote
11321132
function $fname($(args...))
1133-
function f()
1134-
$body
1135-
end
1136-
res = f()
1133+
# we need to create a closure to escape explicit return in `body`.
1134+
res = (() -> $body)()
11371135
if $isdefined(res, :gui_metadata) && $getfield(res, :gui_metadata) === nothing
11381136
name = $(Meta.quot(fname))
11391137
if $isconnector

0 commit comments

Comments
 (0)