Issue #350: Make shadow check for outer scopes as well

Signed-off-by: Anton Kovalyov <anton@kovalyov.net>