Common sense would seem to indicate that each leg is treated separately, so the lower aircraft on the base leg is ahead of the higher aircraft on the base leg, and both are ahead of aircraft on the downwind. And arriving traffic does their best to fit in to the traffic flow.