Skip to content

Commit 7168562

Browse files
committed
allow user to overwrite body with non-block in combinedef
1 parent 95e5df1 commit 7168562

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/utils.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ function combinedef(dict::Dict)
288288
rtype = get(dict, :rtype, nothing)
289289
params = get(dict, :params, [])
290290
wparams = get(dict, :whereparams, [])
291+
body = block(dict[:body])
291292
name = dict[:name]
292293
name_param = isempty(params) ? name : :($name{$(params...)})
293294
# We need the `if` to handle parametric inner/outer constructors like
@@ -296,24 +297,24 @@ function combinedef(dict::Dict)
296297
if rtype==nothing
297298
@q(function $name_param($(dict[:args]...);
298299
$(dict[:kwargs]...))
299-
$(dict[:body].args...)
300+
$(body.args...)
300301
end)
301302
else
302303
@q(function $name_param($(dict[:args]...);
303304
$(dict[:kwargs]...))::$rtype
304-
$(dict[:body].args...)
305+
$(body.args...)
305306
end)
306307
end
307308
else
308309
if rtype==nothing
309310
@q(function $name_param($(dict[:args]...);
310311
$(dict[:kwargs]...)) where {$(wparams...)}
311-
$(dict[:body].args...)
312+
$(body.args...)
312313
end)
313314
else
314315
@q(function $name_param($(dict[:args]...);
315316
$(dict[:kwargs]...))::$rtype where {$(wparams...)}
316-
$(dict[:body].args...)
317+
$(body.args...)
317318
end)
318319
end
319320
end

0 commit comments

Comments
 (0)