You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was surprised by the exported Walk function using the inspector type
to then call the unexported walk function, rather than having a single
Walk function without any intermediary state.
From reading the code, it seems like the reason was to interleave
visiting the node comments with the node contents themselves.
However, we were also visiting the node comments in their entirety
as part of walk, meaning we were visiting each comment twice.
Moreover, there weren't any tests for this interleaving of comments,
and I'm fairly sure that the logic wasn't sound, as the Token method
which is meant to advance relative token positions was never called.
On top of that, cue/ast is currently not able to represent comments
which follow an entire node on a new line, as it can only represent
inline comments or comments after a fixed number of tokens.
It seems best to delete this untested and likely broken code for now,
and attempt interleaving the visiting of comments again in the future
once we have tests and better support for relative comment positions
in cue/ast.
For the time being, it seems like none of our walk API uses
were interested in comments at all, so there are no visible changes.
The fact that no user reported the double-walking of comments
also seems to indicate that very few users relied on comment walking.
Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I7d43f5327dcdfc927d2d98c8978476a6da264c56
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194083
Reviewed-by: Roger Peppe <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
0 commit comments