Verify this explicit declaration of call from C and collect all relevant callbacks

Property definitions

nitc :: nitni_callbacks $ AExternCall :: verify_and_collect
	# Verify this explicit declaration of call from C and collect all relevant callbacks
	fun verify_and_collect(npropdef: AMethPropdef, callback_set: ForeignCallbackSet,
		toolcontext: ToolContext) is abstract
src/nitni/nitni_callbacks.nit:275,2--277,39

nitc :: nitni_callbacks $ ASuperExternCall :: verify_and_collect
	redef fun verify_and_collect(npropdef, callback_set, toolcontext)
	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
src/nitni/nitni_callbacks.nit:370,2--375,4

nitc :: nitni_callbacks $ ACastExternCall :: verify_and_collect
	redef fun verify_and_collect(npropdef, callback_set, toolcontext)
	do
		var from = from_mtype
		var to = to_mtype

		callback_set.types.add(from)
		callback_set.types.add(to)

		callback_set.casts.add(new MExplicitCast(from, to))
	end
src/nitni/nitni_callbacks.nit:382,2--391,4

nitc :: nitni_callbacks $ ALocalPropExternCall :: verify_and_collect
	redef fun verify_and_collect(npropdef, callback_set, toolcontext)
	do
		var mmodule = npropdef.mpropdef.mclassdef.mmodule
		var mclass_type = npropdef.mpropdef.mclassdef.bound_mtype
		var m_name = n_methid.collect_text
		var method = toolcontext.modelbuilder.try_get_mproperty_by_name2( self,
			mmodule, mclass_type, m_name )

		if method == null then
			toolcontext.error(location, "Error: local method `{m_name}` not found.")
			return
		end

		var explicit_call = new MExplicitCall(mclass_type, method, mmodule)
		callback_set.callbacks.add(explicit_call)

		explicit_call.fill_type_for(callback_set, mmodule)
	end
src/nitni/nitni_callbacks.nit:281,2--298,4

nitc :: nitni_callbacks $ AFullPropExternCall :: verify_and_collect
	redef fun verify_and_collect(npropdef, callback_set, toolcontext)
	do
		var mmodule = npropdef.mpropdef.mclassdef.mmodule
		var mclassdef = npropdef.mpropdef.mclassdef
		var mclass_type = mclassdef.bound_mtype
		var mtype = toolcontext.modelbuilder.resolve_mtype(mclassdef, n_type)

		if mtype == null then return

		if mtype isa MFormalType then
			mtype = mtype.anchor_to(mmodule, mclass_type)
		end

		if mtype isa MNullableType then
			toolcontext.error(location, "Error: type `{n_type.collect_text}` is nullable and thus cannot be the receiver." )
			return
		end

		var m_name = n_methid.collect_text
		var method = toolcontext.modelbuilder.try_get_mproperty_by_name2( self,
			mmodule, mtype, m_name )

		if method == null then
			toolcontext.error(location, "Error: method `{m_name}` not found in `{n_type.collect_text}`." )
			return
		end

		var explicit_call = new MExplicitCall(mtype.as(MClassType), method, mmodule)
		callback_set.callbacks.add(explicit_call)
		explicit_call.fill_type_for(callback_set, mmodule)
	end
src/nitni/nitni_callbacks.nit:302,2--332,4

nitc :: nitni_callbacks $ AInitPropExternCall :: verify_and_collect
	redef fun verify_and_collect(npropdef, callback_set, toolcontext)
	do
		var mmodule = npropdef.mpropdef.mclassdef.mmodule
		var mclassdef = npropdef.mpropdef.mclassdef
		var mtype = toolcontext.modelbuilder.resolve_mtype(mclassdef, n_type)
		if mtype == null then return

		if not mtype isa MClassType then
			toolcontext.error(location, "Error: type `{n_type.collect_text}` is not a class and thus cannot be used to instantiate a new instance." )
			return
		end

		var meth_name = "new"
		var meth = toolcontext.modelbuilder.try_get_mproperty_by_name2( self,
			mmodule, mtype, meth_name )

		if meth == null then
			meth_name = "defaultinit"
			meth = toolcontext.modelbuilder.try_get_mproperty_by_name2( self,
				mmodule, mtype, meth_name )
		end

		if meth == null then
			toolcontext.error(location, "Error: method `{meth_name}` not found in `{n_type.collect_text}`." )
			return
		end

		var explicit_call = new MExplicitCall(mtype, meth, mmodule)
		callback_set.callbacks.add(explicit_call)
		explicit_call.fill_type_for(callback_set, mmodule)
	end
src/nitni/nitni_callbacks.nit:336,2--366,4

nitc :: nitni_callbacks $ ACastAsExternCall :: verify_and_collect
	redef fun verify_and_collect(npropdef, callback_set, toolcontext)
	do
		var mclassdef = npropdef.mpropdef.mclassdef
		toolcontext.modelbuilder.resolve_mtype_unchecked(mclassdef, n_from_type, true)
		toolcontext.modelbuilder.resolve_mtype_unchecked(mclassdef, n_to_type, true)
		super
	end
src/nitni/nitni_callbacks.nit:398,2--404,4

nitc :: nitni_callbacks $ AAsNullableExternCall :: verify_and_collect
	redef fun verify_and_collect(npropdef, callback_set, toolcontext)
	do
		var mclassdef = npropdef.mpropdef.mclassdef
		toolcontext.modelbuilder.resolve_mtype_unchecked(mclassdef, n_type, true)
		super
	end
src/nitni/nitni_callbacks.nit:411,2--416,4

nitc :: nitni_callbacks $ AAsNotNullableExternCall :: verify_and_collect
	redef fun verify_and_collect(npropdef, callback_set, toolcontext)
	do
		var mclassdef = npropdef.mpropdef.mclassdef
		toolcontext.modelbuilder.resolve_mtype_unchecked(mclassdef, n_type, true)
		super
	end
src/nitni/nitni_callbacks.nit:427,2--432,4