@@ -284,23 +284,37 @@ end
284284`combinedef` is the inverse of `splitdef`. It takes a splitdef-like Dict
285285and returns a function definition. """
286286function combinedef (dict:: Dict )
287- rtype = get (dict, :rtype , :Any )
287+ rtype = get (dict, :rtype , nothing )
288288 params = get (dict, :params , [])
289289 wparams = get (dict, :whereparams , [])
290290 name = dict[:name ]
291291 name_param = isempty (params) ? name : :($ name{$ (params... )})
292292 # We need the `if` to handle parametric inner/outer constructors like
293293 # SomeType{X}(x::X) where X = SomeType{X}(x, x+2)
294294 if isempty (wparams)
295- :(function $name_param ($ (dict[:args ]. .. );
296- $ (dict[:kwargs ]. .. )):: $rtype
297- $ (dict[:body ])
298- end )
295+ if rtype== nothing
296+ @q (function $name_param ($ (dict[:args ]. .. );
297+ $ (dict[:kwargs ]. .. ))
298+ $ (dict[:body ]. args... )
299+ end )
300+ else
301+ @q (function $name_param ($ (dict[:args ]. .. );
302+ $ (dict[:kwargs ]. .. )):: $rtype
303+ $ (dict[:body ]. args... )
304+ end )
305+ end
299306 else
300- :(function $name_param ($ (dict[:args ]. .. );
301- $ (dict[:kwargs ]. .. )):: $rtype where {$ (wparams... )}
302- $ (dict[:body ])
303- end )
307+ if rtype== nothing
308+ @q (function $name_param ($ (dict[:args ]. .. );
309+ $ (dict[:kwargs ]. .. )) where {$ (wparams... )}
310+ $ (dict[:body ]. .. )
311+ end )
312+ else
313+ @q (function $name_param ($ (dict[:args ]. .. );
314+ $ (dict[:kwargs ]. .. )):: $rtype where {$ (wparams... )}
315+ $ (dict[:body ]. .. )
316+ end )
317+ end
304318 end
305319end
306320
0 commit comments