nitc :: MMethodDef :: callref_thunk
Object and cast them to the original mmethoddef signature.
# The C thunk function associated to a mmethoddef. Receives only nullable
# Object and cast them to the original mmethoddef signature.
fun callref_thunk(recv_mtype: MClassType): SeparateThunkFunction
do
var res = callref_thunk_cache
if res == null then
var object_type = mclassdef.mmodule.object_type
var nullable_object = object_type.as_nullable
var ps = new Array[MParameter]
# Replace every argument type by nullable object
for p in msignature.mparameters do
ps.push(new MParameter(p.name, nullable_object, p.is_vararg))
end
var ret: nullable MType = null
if msignature.return_mtype != null then ret = nullable_object
var msignature2 = new MSignature(ps, ret)
var intromclassdef = mproperty.intro.mclassdef
res = new SeparateThunkFunction(self, recv_mtype, msignature2, "THUNK_{c_name}", mclassdef.bound_mtype)
res.polymorph_call_flag = true
callref_thunk_cache = res
end
return res
end
src/compiler/separate_compiler.nit:2387,2--2411,4