Merge: phase: Introduction of new hook method
authorJean Privat <jean@pryen.org>
Tue, 14 Jul 2020 12:42:21 +0000 (08:42 -0400)
committerJean Privat <jean@pryen.org>
Tue, 14 Jul 2020 12:42:21 +0000 (08:42 -0400)
This pr introduces a new hook method in the execution of the `process_nmodule_after_phases` phases. This method makes it possible to analyze each module again after the execution of all phases in order to benefit from the information of the whole program.

This method is useful in the context of contracts. Example:

```nit
module b

redef class A
redef fun foo
is
ensure(result > 2)
do
return 2
end
end

var a = new A
a.bar
```
```nit
module a

class A
fun foo: Int do
return 1
end

fun bar do
self.foo
end
end
```

Actually, when you call the foo property in the bar method, no contract is called, while a postcondition was added by refinement in the `b` module. In fact it was not possible to call the contract face because it was not yet introduced during the analysis of module `a`. It is now possible to re-analyze all the modules to make the redirection once all the information are known.

Pull-Request: #2828


Trivial merge