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)); }
public void InitializeIsFieldsOnlyCtor(bool isFieldsOnlyCtor) { int bitsToSet = (isFieldsOnlyCtor ? IsPhpFieldsOnlyCtorBit : 0) | IsPhpFieldsOnlyCtorPopulatedBit; Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); ThreadSafeFlagOperations.Set(ref _bits, bitsToSet); }
public void InitializeIsExtensionMethod(bool isExtensionMethod) { int bitsToSet = (isExtensionMethod ? IsExtensionMethodBit : 0) | IsExtensionMethodIsPopulatedBit; Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); ThreadSafeFlagOperations.Set(ref _bits, bitsToSet); }
public void SetReturnsVoid(bool value) { ThreadSafeFlagOperations.Set( ref _flags, (int)(ReturnsVoidIsSetBit | (value ? ReturnsVoidBit : 0)) ); }
public void InitializeIsPhpHidden(bool isPhpHidden) { int bitsToSet = (isPhpHidden ? IsPhpHiddenBit : 0) | IsPhpHiddenPopulatedBit; Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); ThreadSafeFlagOperations.Set(ref _bits, bitsToSet); }
public void InitializeIsCastToFalse(bool isCastToFalse) { int bitsToSet = (isCastToFalse ? IsCastToFalseBit : 0) | IsCastToFalsePopulatedBit; Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); ThreadSafeFlagOperations.Set(ref _bits, bitsToSet); }
public bool SetFlowAnalysisAnnotations(FlowAnalysisAnnotations value) { int bitsToSet = FlowAnalysisAnnotationsCompletionBit | (((int)value & FlowAnalysisAnnotationsMask) << FlowAnalysisAnnotationsOffset); return(ThreadSafeFlagOperations.Set(ref _bits, bitsToSet)); }
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); }
public void SetIsVolatile(bool isVolatile) { if (isVolatile) { ThreadSafeFlagOperations.Set(ref _bits, IsVolatileBit); } Debug.Assert(IsVolatile == isVolatile); }
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 }
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); }
public bool SetNullableContext(byte?value) { return(ThreadSafeFlagOperations.Set( ref _flags, ( ((int)value.ToNullableContextFlags() & NullableContextMask) << NullableContextOffset ) )); }
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); } }
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); }
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); }
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); } }
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); }
private void SetNeedsGeneratedAttributes(EmbeddableAttributes attributes) { Debug.Assert(!_needsGeneratedAttributes_IsFrozen); ThreadSafeFlagOperations.Set(ref _needsGeneratedAttributes, (int)attributes); }
public void SetHasNotNull(bool value) { int bitsToSet = HasNotNullPopulatedBit | (value ? HasNotNullBit : 0); ThreadSafeFlagOperations.Set(ref _bits, bitsToSet); }
public void SetDefaultValueFieldPopulated() { ThreadSafeFlagOperations.Set(ref _bits, HasDefaultValueFieldPopulatedBit); }
public bool SetHasRequiredMemberAttribute(bool isRequired) { int bitsToSet = RequiredMemberCompletionBit | (isRequired ? HasRequiredMemberAttribute : 0); return(ThreadSafeFlagOperations.Set(ref _bits, bitsToSet)); }
private void NotePartComplete(CustomAttributeBagCompletionPart part) { ThreadSafeFlagOperations.Set(ref _state, (int)(this.State | part)); }
public void SetHasRequiredMemberAttribute(bool isRequired) { var bitsToSet = (isRequired ? HasRequiredMemberAttribute : 0) | RequiredMemberCompletionBit; ThreadSafeFlagOperations.Set(ref _bits, bitsToSet); }
public void SetIsOverriddenOrHiddenMembersPopulated() { ThreadSafeFlagOperations.Set(ref _bits, IsOverriddenOrHiddenMembersPopulatedBit); }
public void SetIsConditionalAttributePopulated() { ThreadSafeFlagOperations.Set(ref _bits, IsConditionalPopulatedBit); }
public void SetIsUseSiteDiagnosticPopulated() { ThreadSafeFlagOperations.Set(ref _bits, IsUseSiteDiagnosticPopulatedBit); }
public void SetIsCustomAttributesPopulated() { ThreadSafeFlagOperations.Set(ref _bits, IsCustomAttributesPopulatedBit); }
public void SetIsObsoleteAttributePopulated() { ThreadSafeFlagOperations.Set(ref _bits, IsObsoleteAttributePopulatedBit); }