@@ -679,7 +679,27 @@ function has_static_constraints(
679679 return all_the_same (transforms)
680680end
681681
682- function _make_evaluate_args_and_kwargs (model, varinfo, context)
682+ """
683+ gen_evaluator_call_with_types(model[, varinfo, context])
684+
685+ Generate the evaluator call and the types of the arguments.
686+
687+ # Arguments
688+ - `model::Model`: The model whose evaluator is of interest.
689+ - `varinfo::AbstractVarInfo`: The varinfo to use when evaluating the model. Default: `VarInfo(model)`.
690+ - `context::AbstractContext`: The context to use when evaluating the model. Default: [`DefaultContext`](@ref).
691+
692+ # Returns
693+ A 2-tuple with the following elements:
694+ - `ftype::Type`: The function type of the evaluator. This is either `model.f` or `Core.kwcall`, depending on whether
695+ the model has keyword arguments.
696+ - `argtypes::Type{<:Tuple}`: The types of the arguments for the evaluator.
697+ """
698+ function gen_evaluator_call_with_types (
699+ model:: Model ,
700+ varinfo:: AbstractVarInfo = VarInfo (model),
701+ context:: AbstractContext = DefaultContext ()
702+ )
683703 args, kwargs = DynamicPPL. make_evaluate_args_and_kwargs (model, varinfo, context)
684704 return if isempty (kwargs)
685705 (model. f, Base. typesof (args... ))
@@ -709,7 +729,7 @@ function model_warntype(
709729 context:: AbstractContext = DefaultContext ();
710730 optimize:: Bool = false ,
711731)
712- ftype, argtypes = _make_evaluate_args_and_kwargs (model, varinfo, context)
732+ ftype, argtypes = gen_evaluator_call_with_types (model, varinfo, context)
713733 return InteractiveUtils. code_warntype (ftype, argtypes; optimize= optimize)
714734end
715735
@@ -734,7 +754,7 @@ function model_typed(
734754 context:: AbstractContext = DefaultContext ();
735755 optimize:: Bool = true ,
736756)
737- ftype, argtypes = _make_evaluate_args_and_kwargs (model, varinfo, context)
757+ ftype, argtypes = gen_evaluator_call_with_types (model, varinfo, context)
738758 return only (InteractiveUtils. code_typed (ftype, argtypes; optimize= optimize))
739759end
740760
0 commit comments