qid
visible by the module mmodule
.Visibility in modules and qualified names are correctly handled.
If more than one class exists, then null is silently returned.
It is up to the caller to post-analysis the result and display a correct error message.
The method class_not_found
can be used to display such a message.
# Return a class identified by `qid` visible by the module `mmodule`.
# Visibility in modules and qualified names are correctly handled.
#
# If more than one class exists, then null is silently returned.
# It is up to the caller to post-analysis the result and display a correct error message.
# The method `class_not_found` can be used to display such a message.
fun try_get_mclass_by_qid(qid: AQclassid, mmodule: MModule): nullable MClass
do
var name = qid.n_id.text
var classes = model.get_mclasses_by_name(name)
if classes == null then
return null
end
var res: nullable MClass = null
for mclass in classes do
if not mmodule.in_importation <= mclass.intro_mmodule then continue
if not mmodule.is_visible(mclass.intro_mmodule, mclass.visibility) then continue
if not qid.accept(mclass) then continue
if res == null then
res = mclass
else
return null
end
end
return res
end
src/modelbuilder_base.nit:84,2--112,4