fix($parse): check function call context to be safe

Closes #4417