Closed Louis-Vincent closed 5 years ago
Following your idea, should we also protect write services on MModule::mclassdefs
: https://github.com/nitlang/nit/pull/2777/files#diff-c008a218a118b9a750328dbea9b1e216R176
Maybe declaring it as var mclassdefs: Sequence[MClassDef] = new Array[MClassDef]
?
@Morriar
Maybe declaring it as var mclassdefs: Sequence[MClassDef] = new Array[MClassDef]?
I'm not sure what you are referring to, but Sequence
seems to have add
method too.
Currently, the constructor of
MClassDef
would directly add itself in theMModule
, like so:mmodule.mclassdefs.add(self)
. However, this could out of dateMModule:flatten_mclass_hierarchy
. If we want better support for model manipulation after all the semantic phases, we need more logic when adding a newMClassDef
in the hierarchy.Moreover, this allows better protection since
MClassDef
no longer needs to knowmmodule.mclassdefs
.Signed-off-by: Louis-Vincent Boudreault lv.boudreault95@gmail.com