X-Git-Url: http://nitlanguage.org diff --git a/src/nitni/nitni_callbacks.nit b/src/nitni/nitni_callbacks.nit index 5cf389f..cb75bc8 100644 --- a/src/nitni/nitni_callbacks.nit +++ b/src/nitni/nitni_callbacks.nit @@ -268,7 +268,7 @@ end redef class AExternCall # Verify this explicit declaration of call from C and collect all relevant callbacks - fun verify_and_collect(npropdef: AExternPropdef, callback_set: ForeignCallbackSet, + fun verify_and_collect(npropdef: AMethPropdef, callback_set: ForeignCallbackSet, toolcontext: ToolContext) is abstract end @@ -298,9 +298,8 @@ redef class AFullPropExternCall do var mmodule = npropdef.mpropdef.mclassdef.mmodule var mclassdef = npropdef.mpropdef.mclassdef - var nclassdef = toolcontext.modelbuilder.mclassdef2nclassdef[mclassdef] var mclass_type = mclassdef.bound_mtype - var mtype = toolcontext.modelbuilder.resolve_mtype(nclassdef, n_type) + var mtype = toolcontext.modelbuilder.resolve_mtype(mmodule, mclassdef, n_type) if mtype == null then return @@ -333,8 +332,7 @@ redef class AInitPropExternCall do var mmodule = npropdef.mpropdef.mclassdef.mmodule var mclassdef = npropdef.mpropdef.mclassdef - var nclassdef = toolcontext.modelbuilder.mclassdef2nclassdef[mclassdef] - var mtype = toolcontext.modelbuilder.resolve_mtype(nclassdef, n_type) + var mtype = toolcontext.modelbuilder.resolve_mtype(mmodule, mclassdef, n_type) if mtype == null then return if not mtype isa MClassType then @@ -362,6 +360,7 @@ redef class ASuperExternCall do callback_set.supers.add( new MExplicitSuper( npropdef.mpropdef.as(not null) ) ) callback_set.types.add( npropdef.mpropdef.mclassdef.mclass.mclass_type ) + npropdef.mpropdef.has_supercall = true end end @@ -387,9 +386,10 @@ redef class ACastAsExternCall redef fun verify_and_collect(npropdef, callback_set, toolcontext) do - var parent_aclassdef = npropdef.parent.as(AClassdef) - toolcontext.modelbuilder.resolve_mtype_unchecked(parent_aclassdef, n_from_type, true) - toolcontext.modelbuilder.resolve_mtype_unchecked(parent_aclassdef, n_to_type, true) + var mclassdef = npropdef.mpropdef.mclassdef + var mmodule = mclassdef.mmodule + toolcontext.modelbuilder.resolve_mtype_unchecked(mmodule, mclassdef, n_from_type, true) + toolcontext.modelbuilder.resolve_mtype_unchecked(mmodule, mclassdef, n_to_type, true) super end end @@ -400,8 +400,9 @@ redef class AAsNullableExternCall redef fun verify_and_collect(npropdef, callback_set, toolcontext) do - var parent_aclassdef = npropdef.parent.as(AClassdef) - toolcontext.modelbuilder.resolve_mtype_unchecked(parent_aclassdef, n_type, true) + var mclassdef = npropdef.mpropdef.mclassdef + var mmodule = mclassdef.mmodule + toolcontext.modelbuilder.resolve_mtype_unchecked(mmodule, mclassdef, n_type, true) super end end @@ -410,14 +411,15 @@ redef class AAsNotNullableExternCall 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 redef fun verify_and_collect(npropdef, callback_set, toolcontext) do - var parent_aclassdef = npropdef.parent.as(AClassdef) - toolcontext.modelbuilder.resolve_mtype_unchecked(parent_aclassdef, n_type, true) + var mclassdef = npropdef.mpropdef.mclassdef + var mmodule = mclassdef.mmodule + toolcontext.modelbuilder.resolve_mtype_unchecked(mmodule, mclassdef, n_type, true) super end end