Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AddMethodBody() [4/4]

MethodBody System.Reflection.Metadata.Ecma335.MethodBodyStreamEncoder.AddMethodBody ( int codeSize,
int maxStack = 8,
int exceptionRegionCount = 0,
bool hasSmallExceptionRegions = true,
StandaloneSignatureHandle localVariablesSignature = default(StandaloneSignatureHandle),
MethodBodyAttributes attributes = MethodBodyAttributes::InitLocals,
bool hasDynamicStackAllocation = false )
inline

Definition at line 41 of file MethodBodyStreamEncoder.cs.

42 {
43 if (codeSize < 0)
44 {
45 Throw.ArgumentOutOfRange("codeSize");
46 }
47 if ((uint)maxStack > 65535u)
48 {
49 Throw.ArgumentOutOfRange("maxStack");
50 }
51 if (!ExceptionRegionEncoder.IsExceptionRegionCountInBounds(exceptionRegionCount))
52 {
53 Throw.ArgumentOutOfRange("exceptionRegionCount");
54 }
55 int bodyOffset = SerializeHeader(codeSize, (ushort)maxStack, exceptionRegionCount, attributes, localVariablesSignature, hasDynamicStackAllocation);
56 Blob instructions = Builder.ReserveBytes(codeSize);
57 ExceptionRegionEncoder exceptionRegions = ((exceptionRegionCount > 0) ? ExceptionRegionEncoder.SerializeTableHeader(Builder, exceptionRegionCount, hasSmallExceptionRegions) : default(ExceptionRegionEncoder));
58 return new MethodBody(bodyOffset, instructions, exceptionRegions);
59 }
int SerializeHeader(int codeSize, ushort maxStack, int exceptionRegionCount, MethodBodyAttributes attributes, StandaloneSignatureHandle localVariablesSignature, bool hasDynamicStackAllocation)

References System.Reflection.Throw.ArgumentOutOfRange(), System.Reflection.Metadata.Ecma335.MethodBodyStreamEncoder.Builder, System.Reflection.Metadata.Ecma335.ExceptionRegionEncoder.IsExceptionRegionCountInBounds(), System.Reflection.Metadata.BlobBuilder.ReserveBytes(), System.Reflection.Metadata.Ecma335.MethodBodyStreamEncoder.SerializeHeader(), and System.Reflection.Metadata.Ecma335.ExceptionRegionEncoder.SerializeTableHeader().