Fixes up function and class handling to not create nested scopes in some cases. Doesn't affect name resolution otherwise.