@@ -13,6 +13,57 @@ macro warnpcfail(ex::Expr)
13
13
end
14
14
15
15
16
+ const __bodyfunction__ = Dict {Method,Any} ()
17
+
18
+ # Find keyword "body functions" (the function that contains the body
19
+ # as written by the developer, called after all missing keyword-arguments
20
+ # have been assigned values), in a manner that doesn't depend on
21
+ # gensymmed names.
22
+ # `mnokw` is the method that gets called when you invoke it without
23
+ # supplying any keywords.
24
+ function __lookup_kwbody__ (mnokw:: Method )
25
+ function getsym (arg)
26
+ isa (arg, Symbol) && return arg
27
+ @assert isa (arg, GlobalRef)
28
+ return arg. name
29
+ end
30
+
31
+ f = get (__bodyfunction__, mnokw, nothing )
32
+ if f === nothing
33
+ fmod = mnokw. module
34
+ # The lowered code for `mnokw` should look like
35
+ # %1 = mkw(kwvalues..., #self#, args...)
36
+ # return %1
37
+ # where `mkw` is the name of the "active" keyword body-function.
38
+ ast = Base. uncompressed_ast (mnokw)
39
+ if isa (ast, Core. CodeInfo) && length (ast. code) >= 2
40
+ callexpr = ast. code[end - 1 ]
41
+ if isa (callexpr, Expr) && callexpr. head == :call
42
+ fsym = callexpr. args[1 ]
43
+ if isa (fsym, Symbol)
44
+ f = getfield (fmod, fsym)
45
+ elseif isa (fsym, GlobalRef)
46
+ if fsym. mod === Core && fsym. name === :_apply
47
+ f = getfield (mnokw. module, getsym (callexpr. args[2 ]))
48
+ elseif fsym. mod === Core && fsym. name === :_apply_iterate
49
+ f = getfield (mnokw. module, getsym (callexpr. args[3 ]))
50
+ else
51
+ f = getfield (fsym. mod, fsym. name)
52
+ end
53
+ else
54
+ f = missing
55
+ end
56
+ else
57
+ f = missing
58
+ end
59
+ else
60
+ f = missing
61
+ end
62
+ __bodyfunction__[mnokw] = f
63
+ end
64
+ return f
65
+ end
66
+
16
67
function _precompile_ ()
17
68
ccall (:jl_generating_output , Cint, ()) == 1 || return nothing
18
69
Base. precompile (Tuple{typeof (RecipesBase. apply_recipe),AbstractDict{Symbol, Any},AbstractMatrix})
@@ -22,12 +73,13 @@ function _precompile_()
22
73
Base. precompile (Tuple{typeof (RecipesBase. apply_recipe),AbstractDict{Symbol, Any},GroupBy,Any,Any})
23
74
Base. precompile (Tuple{typeof (RecipesBase. apply_recipe),AbstractDict{Symbol, Any},GroupBy,Any})
24
75
Base. precompile (Tuple{typeof (RecipesBase. apply_recipe),AbstractDict{Symbol, Any},Type{SliceIt},Any,Any,Any})
25
- Base. precompile (Tuple{typeof (RecipesBase. apply_recipe),AbstractDict{Symbol, Any},Type{typeof (sin)},typeof (sin)})
26
76
Base. precompile (Tuple{typeof (RecipesBase. apply_recipe),AbstractDict{Symbol, Any},Vector{Function},Number,Number})
27
77
Base. precompile (Tuple{typeof (_apply_type_recipe),Any,AbstractArray,Any})
28
78
Base. precompile (Tuple{typeof (_apply_type_recipe),Any,Surface,Any})
29
79
Base. precompile (Tuple{typeof (_compute_xyz),Vector{Float64},Function,Nothing,Bool})
80
+ Base. precompile (Tuple{typeof (_compute_xyz),Vector{String},Vector{String},Nothing,Bool})
30
81
Base. precompile (Tuple{typeof (_extract_group_attributes),Vector{String}})
82
+ Base. precompile (Tuple{typeof (_prepare_series_data),Matrix{Union{Missing, Float64}}})
31
83
Base. precompile (Tuple{typeof (_process_seriesrecipe),Any,Any})
32
84
Base. precompile (Tuple{typeof (_process_seriesrecipes!),Any,Any})
33
85
Base. precompile (Tuple{typeof (_scaled_adapted_grid),Function,Symbol,Symbol,Float64,Irrational{:π }})
@@ -48,4 +100,9 @@ function _precompile_()
48
100
Base. precompile (Tuple{typeof (unzip),Vector{Tuple{Int64, Real}}})
49
101
Base. precompile (Tuple{typeof (unzip),Vector{Tuple{Vector{Float64}, Vector{Float64}}}})
50
102
isdefined (RecipesPipeline, Symbol (" #11#12" )) && Base. precompile (Tuple{getfield (RecipesPipeline, Symbol (" #11#12" )),Int64})
103
+ let fbody = try __lookup_kwbody__ (which (_extract_group_attributes, (Vector{String},Vector{Float64},))) catch missing end
104
+ if ! ismissing (fbody)
105
+ precompile (fbody, (Function,typeof (_extract_group_attributes),Vector{String},Vector{Float64},))
106
+ end
107
+ end
51
108
end
0 commit comments