public PrivateImplementationDetails GetPrivateImplClass(TGreenNode syntaxNodeOpt, DiagnosticBag diagnostics)
        {
            var result = _privateImplementationDetails;

            if ((result == null) && this.SupportsPrivateImplClass)
            {
                result = new PrivateImplementationDetails(
                    this,
                    this.SourceModule.Name,
                    /*Compilation.GetSubmissionSlotIndex()*/ -1,
                    this.GetSpecialType(SpecialType.System_Object, syntaxNodeOpt, diagnostics),
                    this.GetSpecialType(SpecialType.System_ValueType, syntaxNodeOpt, diagnostics),
                    this.GetSpecialType(SpecialType.System_Byte, syntaxNodeOpt, diagnostics),
                    this.GetSpecialType(SpecialType.System_Int16, syntaxNodeOpt, diagnostics),
                    this.GetSpecialType(SpecialType.System_Int32, syntaxNodeOpt, diagnostics),
                    this.GetSpecialType(SpecialType.System_Int64, syntaxNodeOpt, diagnostics),
                    SynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));

                if (Interlocked.CompareExchange(ref _privateImplementationDetails, result, null) != null)
                {
                    result = _privateImplementationDetails;
                }
            }

            return(result);
        }
 private void EnsurePrivateImplementationDetailsStaticConstructor(PrivateImplementationDetails details, TGreenNode syntaxOpt, DiagnosticBag diagnostics)
 {
     if (details.GetMethod(WellKnownMemberNames.StaticConstructorName) == null)
     {
         details.TryAddSynthesizedMethod(CreatePrivateImplementationDetailsStaticConstructor(details, syntaxOpt, diagnostics));
     }
 }
        public IFieldReference GetInstrumentationPayloadRoot(int analysisKind, ITypeReference payloadType, TGreenNode syntaxOpt, DiagnosticBag diagnostics)
        {
            PrivateImplementationDetails details = GetPrivateImplClass(syntaxOpt, diagnostics);

            EnsurePrivateImplementationDetailsStaticConstructor(details, syntaxOpt, diagnostics);

            return(details.GetOrAddInstrumentationPayloadRoot(analysisKind, payloadType));
        }
        public IFieldReference GetModuleVersionId(ITypeReference mvidType, TGreenNode syntaxOpt, DiagnosticBag diagnostics)
        {
            PrivateImplementationDetails details = GetPrivateImplClass(syntaxOpt, diagnostics);

            EnsurePrivateImplementationDetailsStaticConstructor(details, syntaxOpt, diagnostics);

            return(details.GetModuleVersionId(mvidType));
        }
 protected abstract IMethodDefinition CreatePrivateImplementationDetailsStaticConstructor(PrivateImplementationDetails details, TGreenNode syntaxOpt, DiagnosticBag diagnostics);
Beispiel #6
0
 internal ExplicitSizeStruct(uint size, PrivateImplementationDetails containingType, ITypeReference sysValueType)
 {
     _size           = size;
     _containingType = containingType;
     _sysValueType   = sysValueType;
 }