Corrects declarations of methods.

Moves declarations of methods to the surrounding scope,
rather than the (erroneous) method’s own scope.   This required a
flag in the identifier to prevent it from being declared twice.