Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Switch from stable sort which was copied from std, to std.mem.sortUnstable. Remove block.zig. This also has the benefit of working as-is in Zig 0.14, whereas block.zig / std.mem.sort doesn't (and I can't figure out why).
lookupPrototype is now done in a single pass (post-sort). Previous, the initial pass was only really used to set proto_index which the sorter could use (and, in doing so, invalidate proto_index). But, as far as I can tell, proto_index wasn't needed to sort. All you need to know is whether proto_T is null or not and, if both A and B have a proto_T, whether a.proto_T == b.T.
Also optimized lookupPrototype to only scan structs before the current struct, as should be guaranteed by the sort.