Repository navigation
Share logic for discovering typereferences - #2287
Conversation
vitek-karas
left a comment
There was a problem hiding this comment.
Looks good. Looking forward to fixing the SweepStep to not call this twice :-)
| // Also mark the scopes of metadata typeref rows to cover any not discovered by the traversal. | ||
| // This can happen when the compiler emits typerefs into IL which aren't strictly necessary per ECMA 335. | ||
| foreach (TypeReference typeReference in assembly.MainModule.GetTypeReferences ()) { |
There was a problem hiding this comment.
Side question (ignore for PR purposes): Would be interesting to know what would happen if we removed such type ref. If it's not used, then it should not matter that we don't preserve the type forwarder for it. I guess I don't know what Cecil will do when saving the assembly (will it rebuild the type-ref table from scratch, I guess it has to), but then again that will not happen for "copy".
There was a problem hiding this comment.
Good point - I think there would be no harm in not marking these, at least for the final output (which will just have unused dangling typerefs). There could be issues like #2267 since the in-memory representation would be unresolvable, but arguably custom steps should never be looking at these typerefs anyway.
- Add non-nullable property over "visited" hashset - Hide construction/process pattern in static helpers
* Share logic for discovering typereferences * PR feedback - Add non-nullable property over "visited" hashset - Hide construction/process pattern in static helpers Commit migrated from dotnet/linker@8097e39
Factor out the logic for walking an assembly to discover typerefs into a new abstract class,
TypeReferenceWalker.