MichalStrehovsky / iltrim

MIT License
9 stars 1 forks source link

Add support for Properties #39

Closed MichalStrehovsky closed 2 years ago

MichalStrehovsky commented 2 years ago

This is a bit of freestyle issue because it involves multiple tables and I don't want to spend time coming up with a detailed implementation plan. We can discuss on Teams.

Properties are represented in multiple tables. There's the Property table that defines the property name. There's the PropertyMap table that assigns properties to their owning type. And there's MethodSemantics table that assigns accessor methods to properties. See the ECMA spec for some pictures.

I think we'll want to go for a strategy where placing a property into the dependency graph places all the accessors into the dependency graph. We don't currently have anything that would put a property into the graph in the first place, so for your test purposes just AddRoot a property to test things same as it was done for fields in #5.

The MethodSemantics table suffers from the same problems as fieldlist and methodlist, so you have to be ready to write code that deals with this:

https://github.com/MichalStrehovsky/iltrim/blob/f416567a7d888da3243203dcf8394e1519ddb8d1/src/coreclr/tools/ILTrim/ILTrim/TokenMap.Lists.cs#L11-L50

(Your code will likely be a heavy copypaste of what's already there, but I wanted to issue a fair warning.)