Пример #1
0
 void IPgoEncodedValueEmitter <TypeSystemEntityOrUnknown, TypeSystemEntityOrUnknown> .EmitType(TypeSystemEntityOrUnknown type, TypeSystemEntityOrUnknown previousValue)
 {
     if (type.AsType != null)
     {
         _il.OpCode(ILOpCode.Ldtoken);
         _il.Token(_emitter.GetTypeRef(type.AsType));
     }
     else
     {
         _il.LoadConstantI4(type.AsUnknown & 0x00FFFFFF);
     }
 }
            public void EmitAtCurrentIndexStack(BlobBuilder signatureBuilder)
            {
                if (!Complete)
                {
                    if (_embeddedDataIndex < _embeddedData.Length)
                    {
                        string indexData = string.Join(".", _indexStack);
                        while ((_embeddedDataIndex < _embeddedData.Length) && _embeddedData[_embeddedDataIndex].index == indexData)
                        {
                            switch (_embeddedData[_embeddedDataIndex].kind)
                            {
                            case EmbeddedSignatureDataKind.OptionalCustomModifier:
                            {
                                signatureBuilder.WriteByte((byte)SignatureTypeCode.OptionalModifier);
                                EntityHandle handle = _metadataEmitter.GetTypeRef((MetadataType)_embeddedData[_embeddedDataIndex].type);
                                signatureBuilder.WriteCompressedInteger(CodedIndex.TypeDefOrRefOrSpec(handle));
                            }
                            break;

                            case EmbeddedSignatureDataKind.RequiredCustomModifier:
                            {
                                signatureBuilder.WriteByte((byte)SignatureTypeCode.RequiredModifier);
                                EntityHandle handle = _metadataEmitter.GetTypeRef((MetadataType)_embeddedData[_embeddedDataIndex].type);
                                signatureBuilder.WriteCompressedInteger(CodedIndex.TypeDefOrRefOrSpec(handle));
                            }
                            break;

                            default:
                                throw new NotImplementedException();
                            }

                            _embeddedDataIndex++;
                        }
                    }
                }
            }