(#15912) Make function access consistent
Parser functions are normally stored against either the root environment or
the current environment. Before this commit, methods to access functions were
not consistent about retrieving functions from both possible places. This adds
a set of private methods to consistently access functions, and makes the
public methods use these.
Paired-with: Josh Cooper <josh@puppetlabs.com>