Make ResolveIdentities operation depth-first.

This ensures that the following code will work correctly

y = 0
while y < 20
	x = 0 # <- This x variable would be different...
	while x < 30
		x += 1
	end
	y += 1
end

x = 1 # <- ...to this one.
while x < 30
	x += 1
end