Move alternateImpl detection into MethodInfo constructor.

This is the line added to fix the `key is undefined` error from the previous PR.