AddCode() private method

private AddCode ( CILInstructions byteCode ) : uint
byteCode CILInstructions
return uint
Ejemplo n.º 1
0
        internal override sealed void BuildSignatures(MetaDataOut md)
        {
            if (locals != null) {
                localSig.BuildSignatures(md);
                locToken = localSig.Token();
            }
            if (code != null) {
                // If the stack depth has not been explicity set, try to work out what is needed.
                if (maxStack == 0) {
                    try {

                        // Set the flag to show if the return type is void or other.
                        code.ReturnsVoid = GetRetType().SameType(PrimitiveType.Void);

                        // Calculate the max stack depth
                        maxStack = code.GetMaxStackDepthRequired();
                    } catch (CouldNotFindMaxStackDepth) {
                        // Could not find the depth, assign the default
                        maxStack = DefaultMaxStackDepth;
                    }
                }
                code.CheckCode(locToken,initLocals,maxStack,md);
                textOffset = md.AddCode(code);
                if (Diag.DiagOn) Console.WriteLine("code offset = " + textOffset);
            }
            sig.BuildSignatures(md);
            MemoryStream outSig = new MemoryStream();
            TypeSig(outSig);
            sigIx = md.AddToBlobHeap(outSig.ToArray());
            done = false;
        }