SchemaTreeInferenceStack.deque is currently being used as a stack, with push()/pop() being the predominant operations. This leads to the deque being organized on the opposite direction of statement tree and therefore we need to be careful not to use it a Collection and instead use descendingIterator() when interfacing with other constructs.
Invert the ordering of the deque, so that its iterator() order matches the path from root. This will improve interoperability with other constructs, improve debugging experience and allow us to use things like ImmutableList.copyOf()/Collection.addAll().
SchemaTreeInferenceStack.deque is currently being used as a stack, with push()/pop() being the predominant operations. This leads to the deque being organized on the opposite direction of statement tree and therefore we need to be careful not to use it a Collection and instead use descendingIterator() when interfacing with other constructs.
Invert the ordering of the deque, so that its iterator() order matches the path from root. This will improve interoperability with other constructs, improve debugging experience and allow us to use things like ImmutableList.copyOf()/Collection.addAll().