Skip to content

Latest commit

 

History

History
29 lines (15 loc) · 2.05 KB

ii.23.2.1-methoddefsig.md

File metadata and controls

29 lines (15 loc) · 2.05 KB

II.23.2.1 MethodDefSig

A MethodDefSig is indexed by the Method.Signature column. It captures the signature of a method or global function. The syntax diagram for a MethodDefSig is:

This diagram uses the following abbreviations:

  • HASTHIS = 0x20, used to encode the keyword instance in the calling convention, see §II.15.3

  • EXPLICITTHIS = 0x40, used to encode the keyword explicit in the calling convention, see §II.15.3

  • DEFAULT = 0x0, used to encode the keyword default in the calling convention, see §II.15.3

  • VARARG = 0x5, used to encode the keyword vararg in the calling convention, see §II.15.3

  • GENERIC = 0x10, used to indicate that the method has one or more generic parameters.

The first byte of the Signature holds bits for HASTHIS, EXPLICITTHIS and calling convention (DEFAULT, VARARG, or GENERIC). These are ORed together.

GenParamCount is the number of generic parameters for the method. This is a compressed unsigned integer.

[Note: For generic methods, both MethodDef and MemberRef shall include the GENERIC calling convention, together with GenParamCount; these are significant for binding—they enable the CLI to overload on generic methods by the number of generic parameters they include. end note]

ParamCount is an unsigned integer that holds the number of parameters (0 or more). It can be any number between 0 and 0x1FFFFFFF. The compiler compresses it too (see §15) – before storing into the 'blob' (ParamCount counts just the method parameters – it does not include the method's return type)

The RetType item describes the type of the method's return value (§II.23.2.11)

The Param item describes the type of each of the method's parameters. There shall be ParamCount instances of the Param item (§II.23.2.10).