Thanks so much for investigating this!
We should be careful not to mutate inputs but also careful to ensure the performance of query execution is not negatively impacted. One case I imagine would not work correctly here is if a query includes the same fragment in two locations, an error occurring in both locations. The
Add unittest for
Maybe I have misunderstanding?
And the problem of add
Where the field
Currently by my understanding of your code, this will result in printing out two errors, where both errors will report
At the very least, this test should be included so that this is known not to occur.
My opinion on how to maintain the execution path is to maintain this as an additional "Stack" variable provided during execution, rather than mutating the AST provided to the execution.