Return true
if the property was correctly created else return false
.
Warning the signature of the property is not set. This step is done by build_signature
.
# Build the read method property to get the value of the attribute
# Return `true` if the property was correctly created else return `false`.
# Warning the signature of the property is not set. This step is done by `build_signature`.
fun build_read_property(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool
do
var mclass = mclassdef.mclass
var readname = name
var mreadprop = modelbuilder.try_get_mproperty_by_name(self, mclassdef, readname).as(nullable MMethod)
if mreadprop == null then
var mvisibility = new_property_visibility(modelbuilder, mclassdef, self.n_visibility)
mreadprop = new MMethod(mclassdef, readname, self.location, mvisibility)
if not self.check_redef_keyword(modelbuilder, mclassdef, n_kwredef, false, mreadprop) then
mreadprop.is_broken = true
return false
end
else
if mreadprop.is_broken then return false
if not self.check_redef_keyword(modelbuilder, mclassdef, n_kwredef, true, mreadprop) then return false
check_redef_property_visibility(modelbuilder, self.n_visibility, mreadprop)
end
mclassdef.mprop2npropdef[mreadprop] = self
var attr_mpropdef = mpropdef
if attr_mpropdef != null then
mreadprop.getter_for = attr_mpropdef.mproperty
attr_mpropdef.mproperty.getter = mreadprop
end
var mreadpropdef = new MMethodDef(mclassdef, mreadprop, self.location)
self.mreadpropdef = mreadpropdef
modelbuilder.mpropdef2npropdef[mreadpropdef] = self
set_doc(mreadpropdef, modelbuilder)
if mpropdef != null then mpropdef.mdoc = mreadpropdef.mdoc
return true
end
src/modelize/modelize_property.nit:1304,2--1340,4