also fills the set returned by foreign_callbacks
# Verifiy the validity of the explicit callbacks to Nit
# also fills the set returned by foreign_callbacks
fun verify_nitni_callbacks(toolcontext: ToolContext)
do
if foreign_callbacks_cache != null then return
var fcs = new ForeignCallbackSet
var mmodule = mpropdef.mclassdef.mmodule
# receiver
var recv_type = mpropdef.mclassdef.bound_mtype
fcs.types.add(recv_type)
# return type
var rmt = mpropdef.msignature.return_mtype
if rmt != null then
if rmt isa MFormalType then
var mclass_type = mpropdef.mclassdef.bound_mtype
rmt = rmt.anchor_to(mmodule, mclass_type)
end
var mtype = rmt.resolve_for(recv_type, recv_type, mmodule, true)
fcs.types.add(mtype)
end
# params
for p in mpropdef.msignature.mparameters do
var mtype = p.mtype.resolve_for(recv_type, recv_type, mmodule, true)
if mtype isa MFormalType then
var mclass_type = mpropdef.mclassdef.bound_mtype
mtype = mtype.anchor_to(mmodule, mclass_type)
end
fcs.types.add( mtype )
end
# explicit callbacks
if n_extern_calls != null then
for ec in n_extern_calls.n_extern_calls do
ec.verify_and_collect(self, fcs, toolcontext)
end
end
# store result
foreign_callbacks_cache = fcs
end
src/nitni/nitni_callbacks.nit:97,2--141,4
redef fun verify_nitni_callbacks(toolcontext)
do
super
var block = n_extern_code_block
if block != null and block.is_java then
insert_artificial_callbacks(toolcontext)
end
end
src/ffi/java.nit:318,2--326,4