redef fun process_npropdef(npropdef)
do
- if not npropdef isa AExternPropdef then return
+ if not npropdef isa AMethPropdef then return
+ var mpropdef = npropdef.mpropdef
+ if mpropdef == null then return
+ if not mpropdef.is_extern then return
npropdef.verify_nitni_callbacks(toolcontext)
end
end
end
-redef class AExternPropdef
+redef class AMethPropdef
private var foreign_callbacks_cache: nullable ForeignCallbackSet = null
# All foreign callbacks from this method
redef fun accept_rapid_type_visitor(v)
do
+ if foreign_callbacks_cache == null then return
+
for cb in foreign_callbacks.callbacks do v.add_send(cb.recv_mtype, cb.mproperty.as(MMethod))
for cast in foreign_callbacks.casts do v.add_cast_type(cast.to)
for sup in foreign_callbacks.supers do
return
end
- var meth_name = "init"
+ var meth_name = "new"
var meth = toolcontext.modelbuilder.try_get_mproperty_by_name2( self,
mmodule, mtype, meth_name )
if meth == null then
+ meth_name = "init"
+ meth = toolcontext.modelbuilder.try_get_mproperty_by_name2( self,
+ mmodule, mtype, meth_name )
+ end
+
+ if meth == null then
toolcontext.error(location, "Method {meth_name} not found in {n_type.collect_text}." )
return
end
redef fun from_mtype do return n_type.mtype.as_nullable
redef fun to_mtype do
var mtype = n_type.mtype.as(not null)
- if mtype isa MNullableType then return mtype.mtype
+ mtype = mtype.as_notnullable
return mtype
end