@@ -32,36 +32,11 @@ julia> MacroTools.shortdef(ex)
3232More generally it's also possible to use ` splitdef ` and ` combinedef ` to handle
3333the full range of function syntax.
3434
35- ` splitdef(def) ` matches a function definition of the form
36-
37- ``` julia
38- function name (args; kwargs):: rtype where {whereparams}
39- body
40- end
41- ```
42-
43- and returns ` Dict(:name=>..., :args=>..., etc.) ` . The definition can be rebuilt by
44- calling ` MacroTools.combinedef(dict) ` , or explicitly with
45-
46- ``` julia
47- rtype = get (dict, :rtype , :Any )
48- :(function $ (dict[:name ])($ (dict[:args ]. .. );
49- $ (dict[:kwargs ]. .. )):: $rtype where {$ (dict[:whereparams ]. .. )}
50- $ (dict[:body ]. args... )
51- end )
52- ```
53-
54- ` splitarg(arg) ` matches function arguments (whether from a definition or a function call)
55- such as ` x::Int=2 ` and returns ` (arg_name, arg_type, slurp, default) ` . ` default ` is
56- ` nothing ` when there is none. For example:
57-
58- ``` julia
59- julia> map (splitarg, (:(f (y, a= 2 , x:: Int = nothing , args... ))). args[2 : end ])
60- 4 - element Array{Tuple{Symbol,Symbol,Bool,Any},1 }:
61- (:y , :Any , false , nothing )
62- (:a , :Any , false , 2 )
63- (:x , :Int , false , :nothing )
64- (:args , :Any , true , nothing )
35+ ``` @docs
36+ MacroTools.splitdef
37+ MacroTools.combinedef
38+ MacroTools.splitarg
39+ MacroTools.combinearg
6540```
6641
6742## Other Utilities
0 commit comments