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
This patch fixes parts of the .dia file reading. As originally
implemented, the reader would fail and emit an error if a diagnostic had
sub-diagnostics, i.e, a warning with notes.
Part of the issue was that the parser could only handle one block at a
time and couldn't handle the nesting of blocks. After fixing this, it
became apparent that there were some other issues. The parser was
consuming the records in a post-order traversal of the diagnostic graph,
when it really needs to be handling them in a pre-order ordering. This
wasn't an issue as a post-order and pre-ordering are the same if you can
only handle trees with a root node. Emitted in the wrong order, the
filemap, flagmap, and categorymap wouldn't be updated correctly,
resulting on dropping diagnostic information on the floor, when really
the information would come later.
In the end, I recorded the diagnostic records in the pre-order traversal
order into the `diagnosticRecords` property. When exiting from the last
active blockID in a diagnostic tree, I would run over the lists of
records, emitting a diagnostic for each. This way we emit diagnostics in
a pre-order ordering once we have collected all of the information for
the diagnostics in the tree.
Now, there's even more fun to be had. When constructing the diagnostic,
the code made an assumption that filename records, category records, and
flag records would come strictly before the diagnosticInfo, source
range, and fixIt records. This isn't the case. To work around that, I process
filenames, categories, and flags, while visiting the record tree to fully
populate the respective maps. I'm doing it this way because it means that
we don't have to iterate over the records twice in the `Diagnostic`
initializer, and don't need to mutate the maps either. So now we emit full
diagnostics, even when the tagged records come in different orders.
0 commit comments