Avoid extra error messages if method definition is inside function.