Optimise multi-scope function call resolution