# Visibility or modules are not considered
fun get_mclasses_by_name(name: String): nullable Array[MClass]
do
- if mclasses_by_name.has_key(name) then
- return mclasses_by_name[name]
- else
- return null
- end
+ return mclasses_by_name.get_or_null(name)
end
# Collections of properties grouped by their short name
# Visibility or modules are not considered
fun get_mproperties_by_name(name: String): nullable Array[MProperty]
do
- if not mproperties_by_name.has_key(name) then
- return null
- else
- return mproperties_by_name[name]
- end
+ return mproperties_by_name.get_or_null(name)
end
# The only null type
# The visibility of the property
var visibility: MVisibility
+ # Is the property usable as an initializer?
+ var is_autoinit = false is writable
+
init
do
intro_mclassdef.intro_mproperties.add(self)
# If mtype does not know mproperty then an empty array is returned.
#
# If you want the really most specific property, then look at `lookup_first_definition`
+ #
+ # REQUIRE: `not mtype.need_anchor` to simplify the API (no `anchor` parameter)
+ # ENSURE: `not mtype.has_mproperty(mmodule, self) == result.is_empty`
fun lookup_definitions(mmodule: MModule, mtype: MType): Array[MPROPDEF]
do
assert not mtype.need_anchor
#
# If you want the really most specific property, then look at `lookup_next_definition`
#
- # FIXME: Move to `MPropDef`?
+ # REQUIRE: `not mtype.need_anchor` to simplify the API (no `anchor` parameter)
+ # ENSURE: `not mtype.has_mproperty(mmodule, self) implies result.is_empty`
fun lookup_super_definitions(mmodule: MModule, mtype: MType): Array[MPROPDEF]
do
assert not mtype.need_anchor
#
# FIXME: the linearization is still unspecified
#
- # REQUIRE: `not mtype.need_anchor`
+ # REQUIRE: `not mtype.need_anchor` to simplify the API (no `anchor` parameter)
# REQUIRE: `mtype.has_mproperty(mmodule, self)`
fun lookup_first_definition(mmodule: MModule, mtype: MType): MPROPDEF
do
# Return all definitions in a linearization order
# Most specific first, most general last
+ #
+ # REQUIRE: `not mtype.need_anchor` to simplify the API (no `anchor` parameter)
+ # REQUIRE: `mtype.has_mproperty(mmodule, self)`
fun lookup_all_definitions(mmodule: MModule, mtype: MType): Array[MPROPDEF]
do
mtype = mtype.as_notnullable