예제 #1
0
            public bool SetFlowAnalysisAnnotations(FlowAnalysisAnnotations value)
            {
                Debug.Assert((value & ~(FlowAnalysisAnnotations.DisallowNull | FlowAnalysisAnnotations.AllowNull | FlowAnalysisAnnotations.MaybeNull | FlowAnalysisAnnotations.NotNull)) == 0);

                int bitsToSet = FlowAnalysisAnnotationsCompletionBit;

                if ((value & FlowAnalysisAnnotations.DisallowNull) != 0)
                {
                    bitsToSet |= PackedFlags.HasDisallowNullAttribute;
                }
                if ((value & FlowAnalysisAnnotations.AllowNull) != 0)
                {
                    bitsToSet |= PackedFlags.HasAllowNullAttribute;
                }
                if ((value & FlowAnalysisAnnotations.MaybeNull) != 0)
                {
                    bitsToSet |= PackedFlags.HasMaybeNullAttribute;
                }
                if ((value & FlowAnalysisAnnotations.NotNull) != 0)
                {
                    bitsToSet |= PackedFlags.HasNotNullAttribute;
                }

                return(ThreadSafeFlagOperations.Set(ref _bits, bitsToSet));
            }
예제 #2
0
            public void InitializeIsFieldsOnlyCtor(bool isFieldsOnlyCtor)
            {
                int bitsToSet = (isFieldsOnlyCtor ? IsPhpFieldsOnlyCtorBit : 0) | IsPhpFieldsOnlyCtorPopulatedBit;

                Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
                ThreadSafeFlagOperations.Set(ref _bits, bitsToSet);
            }
예제 #3
0
            public void InitializeIsExtensionMethod(bool isExtensionMethod)
            {
                int bitsToSet = (isExtensionMethod ? IsExtensionMethodBit : 0) | IsExtensionMethodIsPopulatedBit;

                Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
                ThreadSafeFlagOperations.Set(ref _bits, bitsToSet);
            }
예제 #4
0
 public void SetReturnsVoid(bool value)
 {
     ThreadSafeFlagOperations.Set(
         ref _flags,
         (int)(ReturnsVoidIsSetBit | (value ? ReturnsVoidBit : 0))
         );
 }
예제 #5
0
            public void InitializeIsPhpHidden(bool isPhpHidden)
            {
                int bitsToSet = (isPhpHidden ? IsPhpHiddenBit : 0) | IsPhpHiddenPopulatedBit;

                Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
                ThreadSafeFlagOperations.Set(ref _bits, bitsToSet);
            }
예제 #6
0
            public void InitializeIsCastToFalse(bool isCastToFalse)
            {
                int bitsToSet = (isCastToFalse ? IsCastToFalseBit : 0) | IsCastToFalsePopulatedBit;

                Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
                ThreadSafeFlagOperations.Set(ref _bits, bitsToSet);
            }
예제 #7
0
            public bool SetFlowAnalysisAnnotations(FlowAnalysisAnnotations value)
            {
                int bitsToSet =
                    FlowAnalysisAnnotationsCompletionBit
                    | (((int)value & FlowAnalysisAnnotationsMask) << FlowAnalysisAnnotationsOffset);

                return(ThreadSafeFlagOperations.Set(ref _bits, bitsToSet));
            }
예제 #8
0
            public void InitializeMethodKind(MethodKind methodKind)
            {
                Debug.Assert((int)methodKind == ((int)methodKind & MethodKindMask));
                int bitsToSet = (((int)methodKind & MethodKindMask) << MethodKindOffset) | MethodKindIsPopulatedBit;

                Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
                ThreadSafeFlagOperations.Set(ref _bits, bitsToSet);
            }
예제 #9
0
 public void SetIsVolatile(bool isVolatile)
 {
     if (isVolatile)
     {
         ThreadSafeFlagOperations.Set(ref _bits, IsVolatileBit);
     }
     Debug.Assert(IsVolatile == isVolatile);
 }
예제 #10
0
        internal bool NotePartComplete(CompletionPart part)
        {
            // passing volatile completeParts byref is ok here.
            // ThreadSafeFlagOperations.Set performs interlocked assignments
#pragma warning disable 0420
            return(ThreadSafeFlagOperations.Set(ref _completeParts, (int)part));

#pragma warning restore 0420
        }
예제 #11
0
            public void InitializeIsExplicitOverride(bool isExplicitFinalizerOverride, bool isExplicitClassOverride)
            {
                int bitsToSet =
                    (isExplicitFinalizerOverride ? IsExplicitFinalizerOverrideBit : 0) |
                    (isExplicitClassOverride ? IsExplicitClassOverrideBit : 0) |
                    IsExplicitOverrideIsPopulatedBit;

                Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
                ThreadSafeFlagOperations.Set(ref _bits, bitsToSet);
            }
예제 #12
0
 public bool SetNullableContext(byte?value)
 {
     return(ThreadSafeFlagOperations.Set(
                ref _flags,
                (
                    ((int)value.ToNullableContextFlags() & NullableContextMask)
                        << NullableContextOffset
                )
                ));
 }
예제 #13
0
            public void SetRefKind(RefKind refKind)
            {
                int bits = ((int)refKind & RefKindMask) << RefKindOffset;

                if (bits != 0)
                {
                    ThreadSafeFlagOperations.Set(ref _bits, bits);
                }
                Debug.Assert(RefKind == refKind);
            }
 public void EnsureMetadataVirtual()
 {
     // ACASEY: This assert is here to check that we're not mutating the value of IsMetadataVirtual after
     // someone has consumed it.  The best practice is to not access IsMetadataVirtual before ForceComplete
     // has been called on all SourceNamedTypeSymbols.  If it is necessary to do so, then you can pass
     // ignoreInterfaceImplementationChanges: true, but you must be conscious that seeing "false" may not
     // reflect the final, emitted modifier.
     Debug.Assert(!IsMetadataVirtualLocked);
     if ((_flags & IsMetadataVirtualBit) == 0)
     {
         ThreadSafeFlagOperations.Set(ref _flags, IsMetadataVirtualBit);
     }
 }
예제 #15
0
        private bool SetWellKnownAttribute(WellKnownAttributeFlags flag, bool value)
        {
            // a value has been decoded:
            int newFlags = (int)flag << WellKnownAttributeCompletionFlagOffset;

            if (value)
            {
                // the actual value:
                newFlags |= (int)flag;
            }

            ThreadSafeFlagOperations.Clear(ref this.lazyWellKnownAttributeData, (int)newFlags);
            return(value);
        }
예제 #16
0
            public bool SetWellKnownAttribute(WellKnownAttributeFlags flag, bool value)
            {
                // a value has been decoded:
                int bitsToSet = (int)flag << WellKnownAttributeCompletionFlagOffset;

                if (value)
                {
                    // the actual value:
                    bitsToSet |= ((int)flag << WellKnownAttributeDataOffset);
                }

                ThreadSafeFlagOperations.Set(ref _bits, bitsToSet);
                return(value);
            }
            public bool IsMetadataVirtual(bool ignoreInterfaceImplementationChanges = false)
            {
                // This flag is immutable, so there's no reason to set a lock bit, as we do below.
                if (ignoreInterfaceImplementationChanges)
                {
                    return((_flags & IsMetadataVirtualIgnoringInterfaceChangesBit) != 0);
                }

                if (!IsMetadataVirtualLocked)
                {
                    ThreadSafeFlagOperations.Set(ref _flags, IsMetadataVirtualLockedBit);
                }

                return((_flags & IsMetadataVirtualBit) != 0);
            }
예제 #18
0
        public override ImmutableArray <Symbol> GetMembers()
        {
            if ((_flags & LazyAllMembersIsSorted) != 0)
            {
                return(_lazyAllMembers);
            }
            else
            {
                var allMembers = this.GetMembersUnordered();

                if (allMembers.Length >= 2)
                {
                    // The array isn't sorted. Sort it and remember that we sorted it.
                    allMembers = allMembers.Sort(LexicalOrderSymbolComparer.Instance);
                    ImmutableInterlocked.InterlockedExchange(ref _lazyAllMembers, allMembers);
                }

                ThreadSafeFlagOperations.Set(ref _flags, LazyAllMembersIsSorted);
                return(allMembers);
            }
        }
예제 #19
0
        public override ImmutableArray <CSharpAttributeData> GetAttributes()
        {
            if (this.lazyCustomAttributes.IsDefault)
            {
                var containingPEModuleSymbol = this.containingType.ContainingPEModule;

                // Could this possibly be an extension method?
                bool alreadySet        = (bitSet & IsExtensionMethodIsPopulatedMask) != 0;
                bool checkForExtension = alreadySet
                    ? (bitSet & IsExtensionMethodMask) != 0
                    : this.MethodKind == MethodKind.Ordinary &&
                                         IsValidExtensionMethodSignature() &&
                                         this.containingType.MightContainExtensionMethods;

                bool isExtensionMethod = false;
                if (checkForExtension)
                {
                    containingPEModuleSymbol.LoadCustomAttributesFilterExtensions(this.handle,
                                                                                  ref this.lazyCustomAttributes,
                                                                                  out isExtensionMethod);
                }
                else
                {
                    containingPEModuleSymbol.LoadCustomAttributes(this.handle,
                                                                  ref this.lazyCustomAttributes);
                }

                if (!alreadySet)
                {
                    ThreadSafeFlagOperations.Set(ref this.bitSet,
                                                 isExtensionMethod
                            ? IsExtensionMethodMask | IsExtensionMethodIsPopulatedMask
                            : IsExtensionMethodIsPopulatedMask);
                }
            }
            return(this.lazyCustomAttributes);
        }
예제 #20
0
 private void SetNeedsGeneratedAttributes(EmbeddableAttributes attributes)
 {
     Debug.Assert(!_needsGeneratedAttributes_IsFrozen);
     ThreadSafeFlagOperations.Set(ref _needsGeneratedAttributes, (int)attributes);
 }
예제 #21
0
            public void SetHasNotNull(bool value)
            {
                int bitsToSet = HasNotNullPopulatedBit | (value ? HasNotNullBit : 0);

                ThreadSafeFlagOperations.Set(ref _bits, bitsToSet);
            }
예제 #22
0
 public void SetDefaultValueFieldPopulated()
 {
     ThreadSafeFlagOperations.Set(ref _bits, HasDefaultValueFieldPopulatedBit);
 }
예제 #23
0
            public bool SetHasRequiredMemberAttribute(bool isRequired)
            {
                int bitsToSet = RequiredMemberCompletionBit | (isRequired ? HasRequiredMemberAttribute : 0);

                return(ThreadSafeFlagOperations.Set(ref _bits, bitsToSet));
            }
예제 #24
0
 private void NotePartComplete(CustomAttributeBagCompletionPart part)
 {
     ThreadSafeFlagOperations.Set(ref _state, (int)(this.State | part));
 }
예제 #25
0
            public void SetHasRequiredMemberAttribute(bool isRequired)
            {
                var bitsToSet = (isRequired ? HasRequiredMemberAttribute : 0) | RequiredMemberCompletionBit;

                ThreadSafeFlagOperations.Set(ref _bits, bitsToSet);
            }
예제 #26
0
 public void SetIsOverriddenOrHiddenMembersPopulated()
 {
     ThreadSafeFlagOperations.Set(ref _bits, IsOverriddenOrHiddenMembersPopulatedBit);
 }
예제 #27
0
 public void SetIsConditionalAttributePopulated()
 {
     ThreadSafeFlagOperations.Set(ref _bits, IsConditionalPopulatedBit);
 }
예제 #28
0
 public void SetIsUseSiteDiagnosticPopulated()
 {
     ThreadSafeFlagOperations.Set(ref _bits, IsUseSiteDiagnosticPopulatedBit);
 }
예제 #29
0
 public void SetIsCustomAttributesPopulated()
 {
     ThreadSafeFlagOperations.Set(ref _bits, IsCustomAttributesPopulatedBit);
 }
예제 #30
0
 public void SetIsObsoleteAttributePopulated()
 {
     ThreadSafeFlagOperations.Set(ref _bits, IsObsoleteAttributePopulatedBit);
 }