Merge: MModule: new method `add_mclassdef` to avoid incoherent cache state.
authorJean Privat <jean@pryen.org>
Wed, 14 Aug 2019 15:22:30 +0000 (11:22 -0400)
committerJean Privat <jean@pryen.org>
Wed, 14 Aug 2019 15:22:30 +0000 (11:22 -0400)
commit8029aa7078e808f2221cb7c0d9f5cc46ad1f0bab
tree2dda0ecb79c68cf19223097e175a2fe320c9c7b0
parentf89c5e271b33d71c69b24a2325f6ee82212745b2
parentb8f3609eec674ba2cf6f42dfbd60a61c55bbf244
Merge: MModule: new method `add_mclassdef` to avoid incoherent cache state.

Currently, the constructor of `MClassDef` would directly add itself in the `MModule`, like so:
`mmodule.mclassdefs.add(self)`. However, this could out of date `MModule:flatten_mclass_hierarchy`.
If we want better support for model manipulation after all the semantic phases, we need more logic when adding a new `MClassDef` in the hierarchy.

Moreover,  this allows better protection since `MClassDef` no longer needs to know `mmodule.mclassdefs`.

Signed-off-by: Louis-Vincent Boudreault <lv.boudreault95@gmail.com>

Pull-Request: #2777
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>