It cannot. It still has to check whether there is a local variable in any other scope that is above the one currently being executed, all the way to the top where it finds global.
Same with window in a browser context. You could still have a "window" variable placed between your execution context and the global context.