MichalStrehovsky / iltrim

MIT License
9 stars 1 forks source link

Add support for MethodSpec signatures #37

Closed MichalStrehovsky closed 2 years ago

MichalStrehovsky commented 2 years ago

(Can be worked on once #33 is merged.)

To repro, introduce a generic method in the app. Then call the generic method using a type that is otherwise unreferenced as a generic parameter.

To fix: We're currently copying the signature blob that specifies the generic arguments verbatim, without analyzing or rewriting it:

https://github.com/MichalStrehovsky/iltrim/blob/f416567a7d888da3243203dcf8394e1519ddb8d1/src/coreclr/tools/ILTrim/ILTrim/DependencyAnalysis/TokenBased/MethodSpecificationNode.cs#L27-L41

We'll want to do something similar to what was done to method signatures in https://github.com/MichalStrehovsky/iltrim/pull/33/commits/f632a122539cb89166a4f13761639d8272c7772b so that the blob is interpreted. The format of the blob is simple - header, followed by number of generic arguments (n), followed by n types.