Fix dispatcher creation for method prototypes.

When method prototypes were involved (e.g. forward declarations
for mutual recursion), calls were sometimes dispatched to the
wrong method implementation. One of the reasons was that method
dispatchers were then not always attached to method ASTs in
the correct place.