model: better implementation of the two `intro` methods
authorJean Privat <jean@pryen.org>
Fri, 24 Oct 2014 00:37:53 +0000 (20:37 -0400)
committerJean Privat <jean@pryen.org>
Fri, 24 Oct 2014 00:37:53 +0000 (20:37 -0400)
commit154a41350e0e73b95f6395339aeb5ea795f3c9a9
tree6724f1404be716d90f03c6b75d1fac68481f232d
parente1e9193c7e61b0933014b2ecfaadf2fc4368101c
model: better implementation of the two `intro` methods

MClass and MProperty have a `intro` method the get the introducing
definition.
The initial implementation was to return the first known definition, that
make sense for a model constructed from a source-code where introductions
are read before refinements and redefinitions.

However, for a better robustness of the model that allows to load the
model form a serialized form or allows a model partially loaded, the
first-read definition is not necessary the intro.

This new implementation uses a different approach: the introduction is
the definition in the introducing compound (module for classes and
classdefs for properties). The introducing compound is known since the
construction, thus this new implementation is trivial and does not change
the API.

Signed-off-by: Jean Privat <jean@pryen.org>
src/model/model.nit