744 references to DeclarationModifiers
Microsoft.CodeAnalysis.CSharp (744)
Binder\ExpressionVariableFinder.cs (4)
677
private
DeclarationModifiers
_modifiers;
684
DeclarationModifiers
modifiers,
700
finder._modifiers =
DeclarationModifiers
.None;
728
modifiers:
DeclarationModifiers
.Private,
Declarations\DeclarationTreeBuilder.cs (10)
222
modifiers:
DeclarationModifiers
.Internal |
DeclarationModifiers
.Partial |
DeclarationModifiers
.Sealed,
247
modifiers:
DeclarationModifiers
.Partial,
337
modifiers:
DeclarationModifiers
.Internal |
DeclarationModifiers
.Partial |
DeclarationModifiers
.Sealed,
750
var
modifiers = node.Modifiers.ToDeclarationModifiers(isForTypeDeclaration: true, diagnostics: diagnostics);
814
var
modifiers = node.Modifiers.ToDeclarationModifiers(isForTypeDeclaration: true, diagnostics: diagnostics);
847
var
modifiers = node.Modifiers.ToDeclarationModifiers(isForTypeDeclaration: true, diagnostics: diagnostics);
Declarations\SingleTypeDeclaration.cs (5)
22
private readonly
DeclarationModifiers
_modifiers;
76
DeclarationModifiers
modifiers,
121
public
DeclarationModifiers
Modifiers
256
&& ((thisDecl.Modifiers &
DeclarationModifiers
.File) != 0
257
|| (otherDecl.Modifiers &
DeclarationModifiers
.File) != 0))
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (7)
157
private static
DeclarationModifiers
MakeDeclarationModifiers(ClosureKind closureKind, MethodSymbol originalMethod)
159
var
mods = closureKind == ClosureKind.ThisOnly ?
DeclarationModifiers
.Private :
DeclarationModifiers
.Internal;
163
mods |=
DeclarationModifiers
.Static;
168
mods |=
DeclarationModifiers
.Async;
173
mods |=
DeclarationModifiers
.Extern;
Lowering\MethodToClassRewriter.cs (1)
738
: base(containingType, methodBeingWrapped, syntax.SyntaxTree.GetReference(syntax), syntax.GetLocation(), name,
DeclarationModifiers
.Private,
Lowering\SynthesizedMethodBaseSymbol.cs (1)
37
DeclarationModifiers
declarationModifiers,
Parser\LanguageParser.cs (42)
1291
private static
DeclarationModifiers
GetModifierExcludingScoped(SyntaxToken token)
1294
internal static
DeclarationModifiers
GetModifierExcludingScoped(SyntaxKind kind, SyntaxKind contextualKind)
1299
return
DeclarationModifiers
.Public;
1301
return
DeclarationModifiers
.Internal;
1303
return
DeclarationModifiers
.Protected;
1305
return
DeclarationModifiers
.Private;
1307
return
DeclarationModifiers
.Sealed;
1309
return
DeclarationModifiers
.Abstract;
1311
return
DeclarationModifiers
.Static;
1313
return
DeclarationModifiers
.Virtual;
1315
return
DeclarationModifiers
.Extern;
1317
return
DeclarationModifiers
.New;
1319
return
DeclarationModifiers
.Override;
1321
return
DeclarationModifiers
.ReadOnly;
1323
return
DeclarationModifiers
.Volatile;
1325
return
DeclarationModifiers
.Unsafe;
1327
return
DeclarationModifiers
.Partial;
1329
return
DeclarationModifiers
.Async;
1331
return
DeclarationModifiers
.Ref;
1336
return
DeclarationModifiers
.Partial;
1338
return
DeclarationModifiers
.Async;
1340
return
DeclarationModifiers
.Required;
1342
return
DeclarationModifiers
.File;
1347
return
DeclarationModifiers
.None;
1359
var
newMod = GetModifierExcludingScoped(this.CurrentToken);
1361
Debug.Assert(newMod !=
DeclarationModifiers
.Scoped);
1362
if (newMod ==
DeclarationModifiers
.None)
1381
case
DeclarationModifiers
.Partial:
1395
(IsPossibleStartOfTypeDeclaration(nextToken.Kind) && GetModifierExcludingScoped(nextToken) !=
DeclarationModifiers
.None))
1407
case
DeclarationModifiers
.Ref:
1432
case
DeclarationModifiers
.File:
1442
case
DeclarationModifiers
.Async:
1451
case
DeclarationModifiers
.Required:
1496
Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken && GetModifierExcludingScoped(this.CurrentToken) !=
DeclarationModifiers
.None);
1609
return !SyntaxFacts.IsContextualKeyword(nextToken.ContextualKind) && GetModifierExcludingScoped(nextToken) !=
DeclarationModifiers
.None;
2095
if (GetModifierExcludingScoped(this.CurrentToken) !=
DeclarationModifiers
.None)
2919
if (GetModifierExcludingScoped(this.CurrentToken) !=
DeclarationModifiers
.None &&
4205
if (GetModifierExcludingScoped(this.CurrentToken) ==
DeclarationModifiers
.None)
4211
while (GetModifierExcludingScoped(this.PeekToken(peekIndex)) !=
DeclarationModifiers
.None)
8571
DeclarationModifiers
modifier = GetModifierExcludingScoped(nextToken);
8572
if (modifier ==
DeclarationModifiers
.Partial)
8586
else if (modifier !=
DeclarationModifiers
.None)
Symbols\AliasSymbol.cs (1)
388
this.CheckUnsafeModifier(
DeclarationModifiers
.Unsafe, usingDirective.UnsafeKeyword.GetLocation(), diagnostics);
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (6)
24
protected abstract
DeclarationModifiers
Modifiers { get; }
46
=> (Modifiers &
DeclarationModifiers
.Static) != 0;
49
=> (Modifiers &
DeclarationModifiers
.ReadOnly) != 0;
55
=> (Modifiers &
DeclarationModifiers
.Const) != 0;
58
=> (Modifiers &
DeclarationModifiers
.Volatile) != 0;
61
=> (Modifiers &
DeclarationModifiers
.Fixed) != 0;
Symbols\Source\GlobalExpressionVariable.cs (3)
30
DeclarationModifiers
modifiers,
43
DeclarationModifiers
modifiers,
169
DeclarationModifiers
modifiers,
Symbols\Source\LocalFunctionSymbol.cs (10)
21
private readonly
DeclarationModifiers
_declarationModifiers;
51
DeclarationModifiers
.Private |
358
public override bool IsAsync => (_declarationModifiers &
DeclarationModifiers
.Async) != 0;
360
public override bool IsStatic => (_declarationModifiers &
DeclarationModifiers
.Static) != 0;
362
public override bool IsVirtual => (_declarationModifiers &
DeclarationModifiers
.Virtual) != 0;
364
public override bool IsOverride => (_declarationModifiers &
DeclarationModifiers
.Override) != 0;
366
public override bool IsAbstract => (_declarationModifiers &
DeclarationModifiers
.Abstract) != 0;
368
public override bool IsSealed => (_declarationModifiers &
DeclarationModifiers
.Sealed) != 0;
370
public override bool IsExtern => (_declarationModifiers &
DeclarationModifiers
.Extern) != 0;
372
public bool IsUnsafe => (_declarationModifiers &
DeclarationModifiers
.Unsafe) != 0;
Symbols\Source\ModifierUtils.cs (167)
15
internal static
DeclarationModifiers
MakeAndCheckNonTypeMemberModifiers(
19
DeclarationModifiers
defaultAccess,
20
DeclarationModifiers
allowedModifiers,
25
var
result = modifiers.ToDeclarationModifiers(isForTypeDeclaration: false, diagnostics.DiagnosticBag ?? new DiagnosticBag(), isOrdinaryMethod: isOrdinaryMethod);
32
if ((result &
DeclarationModifiers
.AccessibilityMask) == 0)
38
internal static
DeclarationModifiers
CheckModifiers(
41
DeclarationModifiers
modifiers,
42
DeclarationModifiers
allowedModifiers,
51
DeclarationModifiers
reportStaticNotVirtualForModifiers =
DeclarationModifiers
.None;
55
Debug.Assert((allowedModifiers & (
DeclarationModifiers
.Override |
DeclarationModifiers
.Virtual)) == 0);
57
else if ((modifiers & allowedModifiers &
DeclarationModifiers
.Static) != 0)
61
reportStaticNotVirtualForModifiers = allowedModifiers &
DeclarationModifiers
.Override;
65
reportStaticNotVirtualForModifiers = allowedModifiers & (
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Override |
DeclarationModifiers
.Virtual);
71
DeclarationModifiers
errorModifiers = modifiers & ~allowedModifiers;
72
DeclarationModifiers
result = modifiers & allowedModifiers;
74
while (errorModifiers !=
DeclarationModifiers
.None)
76
DeclarationModifiers
oneError = errorModifiers & ~(errorModifiers - 1);
77
Debug.Assert(oneError !=
DeclarationModifiers
.None);
82
case
DeclarationModifiers
.Partial:
87
case
DeclarationModifiers
.Abstract:
88
case
DeclarationModifiers
.Override:
89
case
DeclarationModifiers
.Virtual:
107
checkFeature(
DeclarationModifiers
.PrivateProtected, MessageID.IDS_FeaturePrivateProtected) |
108
checkFeature(
DeclarationModifiers
.Required, MessageID.IDS_FeatureRequiredMembers) |
109
checkFeature(
DeclarationModifiers
.File, MessageID.IDS_FeatureFileTypes) |
110
checkFeature(
DeclarationModifiers
.Async, MessageID.IDS_FeatureAsync);
114
bool checkFeature(
DeclarationModifiers
modifier, MessageID featureID)
146
DeclarationModifiers
modifiers,
147
DeclarationModifiers
defaultInterfaceImplementationModifiers,
156
if ((modifiers & defaultInterfaceImplementationModifiers &
DeclarationModifiers
.Static) != 0 &&
157
(modifiers & defaultInterfaceImplementationModifiers & (
DeclarationModifiers
.Sealed |
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Virtual)) != 0)
159
var
reportModifiers =
DeclarationModifiers
.Sealed |
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Virtual;
160
if ((modifiers & defaultInterfaceImplementationModifiers &
DeclarationModifiers
.Sealed) != 0 &&
161
(modifiers & defaultInterfaceImplementationModifiers & (
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Virtual)) != 0)
163
diagnostics.Add(ErrorCode.ERR_BadMemberFlag, errorLocation, ConvertSingleModifierToSyntaxText(
DeclarationModifiers
.Sealed));
164
reportModifiers &= ~
DeclarationModifiers
.Sealed;
178
if ((modifiers & defaultInterfaceImplementationModifiers &
DeclarationModifiers
.Static) != 0)
194
internal static void ReportUnsupportedModifiersForLanguageVersion(
DeclarationModifiers
modifiers,
DeclarationModifiers
unsupportedModifiers, Location errorLocation, BindingDiagnosticBag diagnostics, LanguageVersion availableVersion, LanguageVersion requiredVersion)
196
DeclarationModifiers
errorModifiers = modifiers & unsupportedModifiers;
199
while (errorModifiers !=
DeclarationModifiers
.None)
201
DeclarationModifiers
oneError = errorModifiers & ~(errorModifiers - 1);
202
Debug.Assert(oneError !=
DeclarationModifiers
.None);
211
internal static void CheckFeatureAvailabilityForStaticAbstractMembersInInterfacesIfNeeded(
DeclarationModifiers
mods, bool isExplicitInterfaceImplementation, Location location, BindingDiagnosticBag diagnostics)
213
if (isExplicitInterfaceImplementation && (mods &
DeclarationModifiers
.Static) != 0)
221
ModifierUtils.ReportUnsupportedModifiersForLanguageVersion(mods,
DeclarationModifiers
.Static, location, diagnostics, availableVersion, requiredVersion);
226
internal static
DeclarationModifiers
AdjustModifiersForAnInterfaceMember(
DeclarationModifiers
mods, bool hasBody, bool isExplicitInterfaceImplementation)
230
if ((mods &
DeclarationModifiers
.Abstract) != 0)
232
mods |=
DeclarationModifiers
.Sealed;
235
else if ((mods &
DeclarationModifiers
.Static) != 0)
237
mods &= ~
DeclarationModifiers
.Sealed;
239
else if ((mods & (
DeclarationModifiers
.Private |
DeclarationModifiers
.Partial |
DeclarationModifiers
.Virtual |
DeclarationModifiers
.Abstract)) == 0)
243
if (hasBody || (mods & (
DeclarationModifiers
.Extern |
DeclarationModifiers
.Sealed)) != 0)
245
if ((mods &
DeclarationModifiers
.Sealed) == 0)
247
mods |=
DeclarationModifiers
.Virtual;
251
mods &= ~
DeclarationModifiers
.Sealed;
256
mods |=
DeclarationModifiers
.Abstract;
260
if ((mods &
DeclarationModifiers
.AccessibilityMask) == 0)
262
if ((mods &
DeclarationModifiers
.Partial) == 0 && !isExplicitInterfaceImplementation)
264
mods |=
DeclarationModifiers
.Public;
268
mods |=
DeclarationModifiers
.Private;
275
internal static string ConvertSingleModifierToSyntaxText(
DeclarationModifiers
modifier)
279
case
DeclarationModifiers
.Abstract:
281
case
DeclarationModifiers
.Sealed:
283
case
DeclarationModifiers
.Static:
285
case
DeclarationModifiers
.New:
287
case
DeclarationModifiers
.Public:
289
case
DeclarationModifiers
.Protected:
291
case
DeclarationModifiers
.Internal:
293
case
DeclarationModifiers
.ProtectedInternal:
295
case
DeclarationModifiers
.Private:
297
case
DeclarationModifiers
.PrivateProtected:
299
case
DeclarationModifiers
.ReadOnly:
301
case
DeclarationModifiers
.Const:
303
case
DeclarationModifiers
.Volatile:
305
case
DeclarationModifiers
.Extern:
307
case
DeclarationModifiers
.Partial:
309
case
DeclarationModifiers
.Unsafe:
311
case
DeclarationModifiers
.Fixed:
313
case
DeclarationModifiers
.Virtual:
315
case
DeclarationModifiers
.Override:
317
case
DeclarationModifiers
.Async:
319
case
DeclarationModifiers
.Ref:
321
case
DeclarationModifiers
.Required:
323
case
DeclarationModifiers
.Scoped:
325
case
DeclarationModifiers
.File:
332
private static
DeclarationModifiers
ToDeclarationModifier(SyntaxKind kind)
337
return
DeclarationModifiers
.Abstract;
339
return
DeclarationModifiers
.Async;
341
return
DeclarationModifiers
.Sealed;
343
return
DeclarationModifiers
.Static;
345
return
DeclarationModifiers
.New;
347
return
DeclarationModifiers
.Public;
349
return
DeclarationModifiers
.Protected;
351
return
DeclarationModifiers
.Internal;
353
return
DeclarationModifiers
.Private;
355
return
DeclarationModifiers
.Extern;
357
return
DeclarationModifiers
.ReadOnly;
359
return
DeclarationModifiers
.Partial;
361
return
DeclarationModifiers
.Unsafe;
363
return
DeclarationModifiers
.Virtual;
365
return
DeclarationModifiers
.Override;
367
return
DeclarationModifiers
.Const;
369
return
DeclarationModifiers
.Fixed;
371
return
DeclarationModifiers
.Volatile;
373
return
DeclarationModifiers
.Ref;
375
return
DeclarationModifiers
.Required;
377
return
DeclarationModifiers
.Scoped;
379
return
DeclarationModifiers
.File;
385
public static
DeclarationModifiers
ToDeclarationModifiers(
388
var
result =
DeclarationModifiers
.None;
394
DeclarationModifiers
one = ToDeclarationModifier(modifier.ContextualKind());
401
if (one ==
DeclarationModifiers
.Partial)
422
switch (result &
DeclarationModifiers
.AccessibilityMask)
424
case
DeclarationModifiers
.Protected |
DeclarationModifiers
.Internal:
426
result &= ~
DeclarationModifiers
.AccessibilityMask;
427
result |=
DeclarationModifiers
.ProtectedInternal;
430
case
DeclarationModifiers
.Private |
DeclarationModifiers
.Protected:
432
result &= ~
DeclarationModifiers
.AccessibilityMask;
433
result |=
DeclarationModifiers
.PrivateProtected;
442
DeclarationModifiers
modifierKind,
443
DeclarationModifiers
allModifiers,
460
internal static bool CheckAccessibility(
DeclarationModifiers
modifiers, Symbol symbol, bool isExplicitInterfaceImplementation, BindingDiagnosticBag diagnostics, Location errorLocation)
470
(symbol.Kind != SymbolKind.Method || (modifiers &
DeclarationModifiers
.Partial) == 0) &&
471
(modifiers &
DeclarationModifiers
.Static) == 0)
473
switch (modifiers &
DeclarationModifiers
.AccessibilityMask)
475
case
DeclarationModifiers
.Protected:
476
case
DeclarationModifiers
.ProtectedInternal:
477
case
DeclarationModifiers
.PrivateProtected:
488
if ((modifiers &
DeclarationModifiers
.Required) != 0)
502
case FieldSymbol when (modifiers &
DeclarationModifiers
.ReadOnly) != 0:
518
internal static Accessibility EffectiveAccessibility(
DeclarationModifiers
modifiers)
520
switch (modifiers &
DeclarationModifiers
.AccessibilityMask)
522
case
DeclarationModifiers
.None:
524
case
DeclarationModifiers
.Private:
526
case
DeclarationModifiers
.Protected:
528
case
DeclarationModifiers
.Internal:
530
case
DeclarationModifiers
.Public:
532
case
DeclarationModifiers
.ProtectedInternal:
534
case
DeclarationModifiers
.PrivateProtected:
544
internal static bool IsValidAccessibility(
DeclarationModifiers
modifiers)
546
switch (modifiers &
DeclarationModifiers
.AccessibilityMask)
548
case
DeclarationModifiers
.None:
549
case
DeclarationModifiers
.Private:
550
case
DeclarationModifiers
.Protected:
551
case
DeclarationModifiers
.Internal:
552
case
DeclarationModifiers
.Public:
553
case
DeclarationModifiers
.ProtectedInternal:
554
case
DeclarationModifiers
.PrivateProtected:
Symbols\Source\SourceConstructorSymbol.cs (16)
80
private static (
DeclarationModifiers
, Flags) MakeModifiersAndFlags(
91
DeclarationModifiers
declarationModifiers = MakeModifiers(containingType, syntax, methodKind, syntax.HasAnyBody(), location, diagnostics, out modifierErrors, out report_ERR_StaticConstructorWithAccessModifiers);
122
private static
DeclarationModifiers
MakeModifiers(
126
var
defaultAccess = (methodKind == MethodKind.StaticConstructor) ?
DeclarationModifiers
.None :
DeclarationModifiers
.Private;
129
const
DeclarationModifiers
allowedModifiers =
130
DeclarationModifiers
.AccessibilityMask |
131
DeclarationModifiers
.Static |
132
DeclarationModifiers
.Extern |
133
DeclarationModifiers
.Unsafe;
136
var
mods = ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: false, isForInterfaceMember: isInterface, syntax.Modifiers, defaultAccess, allowedModifiers, location, diagnostics, out modifierErrors);
144
if ((mods &
DeclarationModifiers
.AccessibilityMask) != 0 &&
147
mods = mods & ~
DeclarationModifiers
.AccessibilityMask;
152
mods |=
DeclarationModifiers
.Private; // we mark static constructors private in the symbol table
157
DeclarationModifiers
.Extern,
Symbols\Source\SourceConstructorSymbolBase.cs (1)
27
(
DeclarationModifiers
declarationModifiers, Flags flags) modifiersAndFlags)
Symbols\Source\SourceDelegateMethodSymbol.cs (8)
28
DeclarationModifiers
declarationModifiers)
217
: base(delegateType, voidType, syntax, MethodKind.Constructor, RefKind.None,
DeclarationModifiers
.Public)
262
: base(delegateType, returnType, syntax, MethodKind.DelegateInvoke, refKind,
DeclarationModifiers
.Virtual |
DeclarationModifiers
.Public)
355
: base((SourceNamedTypeSymbol)invoke.ContainingType, iAsyncResultType, syntax, MethodKind.Ordinary, RefKind.None,
DeclarationModifiers
.Virtual |
DeclarationModifiers
.Public)
393
: base((SourceNamedTypeSymbol)invoke.ContainingType, invoke.ReturnTypeWithAnnotations, syntax, MethodKind.Ordinary, invoke.RefKind,
DeclarationModifiers
.Virtual |
DeclarationModifiers
.Public)
Symbols\Source\SourceDestructorSymbol.cs (10)
64
private static (
DeclarationModifiers
, Flags) MakeModifiersAndFlags(NamedTypeSymbol containingType, DestructorDeclarationSyntax syntax, bool isNullableAnalysisEnabled, Location location, BindingDiagnosticBag diagnostics, out bool modifierErrors)
66
DeclarationModifiers
declarationModifiers = MakeModifiers(containingType, syntax.Modifiers, location, diagnostics, out modifierErrors);
129
private static
DeclarationModifiers
MakeModifiers(NamedTypeSymbol containingType, SyntaxTokenList modifiers, Location location, BindingDiagnosticBag diagnostics, out bool modifierErrors)
132
const
DeclarationModifiers
allowedModifiers =
DeclarationModifiers
.Extern |
DeclarationModifiers
.Unsafe;
133
var
mods = ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: false, isForInterfaceMember: containingType.IsInterface, modifiers,
DeclarationModifiers
.None, allowedModifiers, location, diagnostics, out modifierErrors);
135
mods = (mods & ~
DeclarationModifiers
.AccessibilityMask) |
DeclarationModifiers
.Protected; // we mark destructors protected in the symbol table
Symbols\Source\SourceEnumConstantSymbol.cs (4)
73
protected sealed override
DeclarationModifiers
Modifiers
77
return
DeclarationModifiers
.Const |
DeclarationModifiers
.Static |
DeclarationModifiers
.Public;
Symbols\Source\SourceEventFieldSymbol.cs (2)
28
(associatedEvent.Modifiers & (~
DeclarationModifiers
.AccessibilityMask)) |
DeclarationModifiers
.Private,
Symbols\Source\SourceEventSymbol.cs (38)
27
private readonly
DeclarationModifiers
_modifiers;
370
get { return (_modifiers &
DeclarationModifiers
.Abstract) != 0; }
375
get { return (_modifiers &
DeclarationModifiers
.Extern) != 0; }
380
get { return (_modifiers &
DeclarationModifiers
.Static) != 0; }
385
get { return (_modifiers &
DeclarationModifiers
.Override) != 0; }
390
get { return (_modifiers &
DeclarationModifiers
.Sealed) != 0; }
395
get { return (_modifiers &
DeclarationModifiers
.Virtual) != 0; }
400
get { return (_modifiers &
DeclarationModifiers
.ReadOnly) != 0; }
430
get { return (_modifiers &
DeclarationModifiers
.New) != 0; }
433
internal
DeclarationModifiers
Modifiers
443
private
DeclarationModifiers
MakeModifiers(SyntaxTokenList modifiers, bool explicitInterfaceImplementation,
448
var
defaultAccess = isInterface && !explicitInterfaceImplementation ?
DeclarationModifiers
.Public :
DeclarationModifiers
.Private;
449
var
defaultInterfaceImplementationModifiers =
DeclarationModifiers
.None;
452
var
allowedModifiers =
DeclarationModifiers
.Unsafe;
455
allowedModifiers |=
DeclarationModifiers
.New |
456
DeclarationModifiers
.Sealed |
457
DeclarationModifiers
.Abstract |
458
DeclarationModifiers
.Static |
459
DeclarationModifiers
.Virtual |
460
DeclarationModifiers
.AccessibilityMask;
464
allowedModifiers |=
DeclarationModifiers
.Override;
470
defaultAccess =
DeclarationModifiers
.None;
472
allowedModifiers |=
DeclarationModifiers
.Extern;
473
defaultInterfaceImplementationModifiers |=
DeclarationModifiers
.Sealed |
474
DeclarationModifiers
.Abstract |
475
DeclarationModifiers
.Static |
476
DeclarationModifiers
.Virtual |
477
DeclarationModifiers
.Extern |
478
DeclarationModifiers
.AccessibilityMask;
487
allowedModifiers |=
DeclarationModifiers
.Abstract;
490
allowedModifiers |=
DeclarationModifiers
.Static;
495
allowedModifiers |=
DeclarationModifiers
.ReadOnly;
500
allowedModifiers |=
DeclarationModifiers
.Extern;
503
var
mods = ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: false, isForInterfaceMember: isInterface,
Symbols\Source\SourceFieldSymbol.cs (2)
45
return (Modifiers &
DeclarationModifiers
.New) != 0;
164
internal override bool IsRequired => (Modifiers &
DeclarationModifiers
.Required) != 0;
Symbols\Source\SourceFixedFieldSymbol.cs (1)
30
DeclarationModifiers
modifiers,
Symbols\Source\SourceMemberContainerSymbol.cs (73)
192
private readonly
DeclarationModifiers
_declModifiers;
237
var
modifiers = MakeModifiers(typeKind, diagnostics);
244
int access = (int)(modifiers &
DeclarationModifiers
.AccessibilityMask);
247
if ((modifiers &
DeclarationModifiers
.Partial) != 0)
250
modifiers &= ~
DeclarationModifiers
.AccessibilityMask; // remove them all
251
modifiers |= (
DeclarationModifiers
)access; // except the one
255
var specialType = access == (int)
DeclarationModifiers
.Public
289
private
DeclarationModifiers
MakeModifiers(TypeKind typeKind, BindingDiagnosticBag diagnostics)
292
DeclarationModifiers
defaultAccess;
295
var
allowedModifiers =
DeclarationModifiers
.AccessibilityMask |
DeclarationModifiers
.File;
299
defaultAccess =
DeclarationModifiers
.Internal;
303
allowedModifiers |=
DeclarationModifiers
.New;
307
defaultAccess =
DeclarationModifiers
.Public;
311
defaultAccess =
DeclarationModifiers
.Private;
319
allowedModifiers |=
DeclarationModifiers
.Partial |
DeclarationModifiers
.Sealed |
DeclarationModifiers
.Abstract
320
|
DeclarationModifiers
.Unsafe;
324
allowedModifiers |=
DeclarationModifiers
.Static;
329
allowedModifiers |=
DeclarationModifiers
.Partial |
DeclarationModifiers
.ReadOnly |
DeclarationModifiers
.Unsafe;
333
allowedModifiers |=
DeclarationModifiers
.Ref;
338
allowedModifiers |=
DeclarationModifiers
.Partial |
DeclarationModifiers
.Unsafe;
341
allowedModifiers |=
DeclarationModifiers
.Unsafe;
346
var
mods = MakeAndCheckTypeModifiers(
355
(mods &
DeclarationModifiers
.Abstract) != 0 &&
356
(mods & (
DeclarationModifiers
.Sealed |
DeclarationModifiers
.Static)) != 0)
362
(mods & (
DeclarationModifiers
.Sealed |
DeclarationModifiers
.Static)) == (
DeclarationModifiers
.Sealed |
DeclarationModifiers
.Static))
370
mods |=
DeclarationModifiers
.Abstract;
374
mods |=
DeclarationModifiers
.Sealed;
377
mods |=
DeclarationModifiers
.Sealed;
384
private
DeclarationModifiers
MakeAndCheckTypeModifiers(
385
DeclarationModifiers
defaultAccess,
386
DeclarationModifiers
allowedModifiers,
392
var
result =
DeclarationModifiers
.Unset;
399
var
mods = decl.Modifiers;
401
if (partCount > 1 && (mods &
DeclarationModifiers
.Partial) == 0)
420
if (result ==
DeclarationModifiers
.Unset)
431
if ((result &
DeclarationModifiers
.AccessibilityMask) == 0)
435
else if ((result &
DeclarationModifiers
.File) != 0)
442
if ((result &
DeclarationModifiers
.Partial) == 0)
451
diagnostics.Add((result &
DeclarationModifiers
.File) != 0
473
var
mods = singleDeclaration.Modifiers;
474
if ((mods &
DeclarationModifiers
.Partial) == 0)
841
public override bool IsStatic => HasFlag(
DeclarationModifiers
.Static);
843
public sealed override bool IsRefLikeType => HasFlag(
DeclarationModifiers
.Ref);
845
public override bool IsReadOnly => HasFlag(
DeclarationModifiers
.ReadOnly);
847
public override bool IsSealed => HasFlag(
DeclarationModifiers
.Sealed);
849
public override bool IsAbstract => HasFlag(
DeclarationModifiers
.Abstract);
851
internal bool IsPartial => HasFlag(
DeclarationModifiers
.Partial);
853
internal bool IsNew => HasFlag(
DeclarationModifiers
.New);
855
internal sealed override bool IsFileLocal => HasFlag(
DeclarationModifiers
.File);
857
internal bool IsUnsafe => HasFlag(
DeclarationModifiers
.Unsafe);
878
private bool HasFlag(
DeclarationModifiers
flag) => (_declModifiers & flag) != 0;
4942
var
modifiers = SourceMemberFieldSymbol.MakeModifiers(this, fieldSyntax.Declaration.Variables[0].Identifier, fieldSyntax.Modifiers, isRefField: refKind != RefKind.None, diagnostics, out modifierErrors);
4945
var fieldSymbol = (modifiers &
DeclarationModifiers
.Fixed) == 0
4957
DeclarationModifiers
.Private | (modifiers &
DeclarationModifiers
.Static),
5061
DeclarationModifiers
.Private | (property.IsStatic ?
DeclarationModifiers
.Static : 0),
5099
DeclarationModifiers
.Private | (@event.IsStatic ?
DeclarationModifiers
.Static : 0),
5222
ExpressionFieldFinder.FindExpressionVariables(builder.NonTypeMembers, vdecl, this,
DeclarationModifiers
.Private,
5237
DeclarationModifiers
.Private,
Symbols\Source\SourceMemberFieldSymbol.cs (53)
22
private readonly
DeclarationModifiers
_modifiers;
26
DeclarationModifiers
modifiers,
35
protected sealed override
DeclarationModifiers
Modifiers
165
internal static
DeclarationModifiers
MakeModifiers(NamedTypeSymbol containingType, SyntaxToken firstIdentifier, SyntaxTokenList modifiers, bool isRefField, BindingDiagnosticBag diagnostics, out bool modifierErrors)
168
DeclarationModifiers
defaultAccess =
169
isInterface ?
DeclarationModifiers
.Public :
DeclarationModifiers
.Private;
171
DeclarationModifiers
allowedModifiers =
172
DeclarationModifiers
.AccessibilityMask |
173
DeclarationModifiers
.Const |
174
DeclarationModifiers
.New |
175
DeclarationModifiers
.ReadOnly |
176
DeclarationModifiers
.Static |
177
DeclarationModifiers
.Volatile |
178
DeclarationModifiers
.Fixed |
179
DeclarationModifiers
.Unsafe |
180
DeclarationModifiers
.Abstract |
181
DeclarationModifiers
.Required; // Some of these are filtered out later, when illegal, for better error messages.
184
DeclarationModifiers
result = ModifierUtils.MakeAndCheckNonTypeMemberModifiers(
188
if ((result &
DeclarationModifiers
.Abstract) != 0)
191
result &= ~
DeclarationModifiers
.Abstract;
194
if ((result &
DeclarationModifiers
.Fixed) != 0)
202
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Static, diagnostics, errorLocation);
203
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.ReadOnly, diagnostics, errorLocation);
204
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Const, diagnostics, errorLocation);
205
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Volatile, diagnostics, errorLocation);
206
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Required, diagnostics, errorLocation);
208
result &= ~(
DeclarationModifiers
.Static |
DeclarationModifiers
.ReadOnly |
DeclarationModifiers
.Const |
DeclarationModifiers
.Volatile |
DeclarationModifiers
.Required);
209
Debug.Assert((result & ~(
DeclarationModifiers
.AccessibilityMask |
DeclarationModifiers
.Fixed |
DeclarationModifiers
.Unsafe |
DeclarationModifiers
.New)) == 0);
212
if ((result &
DeclarationModifiers
.Const) != 0)
214
if ((result &
DeclarationModifiers
.Static) != 0)
220
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.ReadOnly, diagnostics, errorLocation);
221
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Volatile, diagnostics, errorLocation);
222
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Unsafe, diagnostics, errorLocation);
224
if (reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Required, diagnostics, errorLocation))
226
result &= ~
DeclarationModifiers
.Required;
229
result |=
DeclarationModifiers
.Static; // "constants are considered static members"
233
if ((result &
DeclarationModifiers
.Static) != 0 && (result &
DeclarationModifiers
.Required) != 0)
237
result &= ~
DeclarationModifiers
.Required;
250
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Static, diagnostics, errorLocation);
251
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Const, diagnostics, errorLocation);
252
reportBadMemberFlagIfAny(result,
DeclarationModifiers
.Volatile, diagnostics, errorLocation);
257
static bool reportBadMemberFlagIfAny(
DeclarationModifiers
result,
DeclarationModifiers
modifier, BindingDiagnosticBag diagnostics, SourceLocation errorLocation)
345
DeclarationModifiers
modifiers,
Symbols\Source\SourceMemberMethodSymbol.cs (21)
174
private static bool ModifiersRequireMetadataVirtual(
DeclarationModifiers
modifiers)
176
return (modifiers & (
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Virtual |
DeclarationModifiers
.Override)) != 0;
182
DeclarationModifiers
declarationModifiers,
195
bool isMetadataVirtual = (isExplicitInterfaceImplementation && (declarationModifiers &
DeclarationModifiers
.Static) == 0) || ModifiersRequireMetadataVirtual(declarationModifiers);
225
DeclarationModifiers
declarationModifiers,
292
protected readonly
DeclarationModifiers
DeclarationModifiers;
325
(
DeclarationModifiers
declarationModifiers, Flags flags) modifiersAndFlags)
396
DeclarationModifiers
declarationModifiers,
591
return (this.DeclarationModifiers &
DeclarationModifiers
.Extern) != 0;
607
return (this.DeclarationModifiers &
DeclarationModifiers
.Sealed) != 0;
615
return (this.DeclarationModifiers &
DeclarationModifiers
.Abstract) != 0;
623
return (this.DeclarationModifiers &
DeclarationModifiers
.Override) != 0;
631
return (this.DeclarationModifiers &
DeclarationModifiers
.Partial) != 0;
639
return (this.DeclarationModifiers &
DeclarationModifiers
.Virtual) != 0;
647
return (this.DeclarationModifiers &
DeclarationModifiers
.New) != 0;
655
return (this.DeclarationModifiers &
DeclarationModifiers
.Static) != 0;
663
return (this.DeclarationModifiers &
DeclarationModifiers
.Unsafe) != 0;
671
return (this.DeclarationModifiers &
DeclarationModifiers
.Async) != 0;
679
return (this.DeclarationModifiers &
DeclarationModifiers
.ReadOnly) != 0;
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (1)
746
declaringSymbol.CheckUnsafeModifier(
DeclarationModifiers
.Unsafe, unsafeKeywordLocation, diagnostics);
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (1)
24
protected SourceOrdinaryMethodOrUserDefinedOperatorSymbol(NamedTypeSymbol containingType, SyntaxReference syntaxReferenceOpt, Location location, bool isIterator, (
DeclarationModifiers
declarationModifiers, Flags flags) modifiersAndFlags)
Symbols\Source\SourceOrdinaryMethodSymbol.cs (46)
89
private static (
DeclarationModifiers
, Flags) MakeModifiersAndFlags(
93
(
DeclarationModifiers
declarationModifiers, hasExplicitAccessMod) = MakeModifiers(syntax, containingType, methodKind, hasBody: syntax.HasAnyBody(), location, diagnostics);
424
private static
DeclarationModifiers
MakeDeclarationModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, Location location,
DeclarationModifiers
allowedModifiers, BindingDiagnosticBag diagnostics)
427
syntax.Modifiers, defaultAccess:
DeclarationModifiers
.None, allowedModifiers, location, diagnostics, out _);
687
private static (
DeclarationModifiers
mods, bool hasExplicitAccessMod) MakeModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, MethodKind methodKind, bool hasBody, Location location, BindingDiagnosticBag diagnostics)
694
var
defaultAccess = isInterface && !isExplicitInterfaceImplementation ?
DeclarationModifiers
.None :
DeclarationModifiers
.Private;
697
var
allowedModifiers =
DeclarationModifiers
.Partial |
DeclarationModifiers
.Unsafe;
698
var
defaultInterfaceImplementationModifiers =
DeclarationModifiers
.None;
702
allowedModifiers |=
DeclarationModifiers
.New |
703
DeclarationModifiers
.Sealed |
704
DeclarationModifiers
.Abstract |
705
DeclarationModifiers
.Static |
706
DeclarationModifiers
.Virtual |
707
DeclarationModifiers
.AccessibilityMask;
711
allowedModifiers |=
DeclarationModifiers
.Override;
715
defaultInterfaceImplementationModifiers |=
DeclarationModifiers
.Sealed |
716
DeclarationModifiers
.Abstract |
717
DeclarationModifiers
.Static |
718
DeclarationModifiers
.Virtual |
719
DeclarationModifiers
.Extern |
720
DeclarationModifiers
.Async |
721
DeclarationModifiers
.Partial |
722
DeclarationModifiers
.AccessibilityMask;
731
allowedModifiers |=
DeclarationModifiers
.Abstract;
734
allowedModifiers |=
DeclarationModifiers
.Static;
737
allowedModifiers |=
DeclarationModifiers
.Extern |
DeclarationModifiers
.Async;
741
allowedModifiers |=
DeclarationModifiers
.ReadOnly;
747
DeclarationModifiers
mods = MakeDeclarationModifiers(syntax, containingType, location, allowedModifiers, diagnostics);
748
if ((mods &
DeclarationModifiers
.AccessibilityMask) == 0)
768
private static
DeclarationModifiers
AddImpliedModifiers(
DeclarationModifiers
mods, bool containingTypeIsInterface, MethodKind methodKind, bool hasBody)
779
mods = (mods & ~
DeclarationModifiers
.AccessibilityMask) |
DeclarationModifiers
.Private;
784
private const
DeclarationModifiers
PartialMethodExtendedModifierMask =
785
DeclarationModifiers
.Virtual |
786
DeclarationModifiers
.Override |
787
DeclarationModifiers
.New |
788
DeclarationModifiers
.Sealed |
789
DeclarationModifiers
.Extern;
Symbols\Source\SourceOrdinaryMethodSymbolBase.cs (1)
34
(
DeclarationModifiers
declarationModifiers, Flags flags) modifiersAndFlags) :
Symbols\Source\SourcePropertyAccessorSymbol.cs (28)
31
DeclarationModifiers
propertyModifiers,
68
DeclarationModifiers
propertyModifiers,
89
DeclarationModifiers
propertyModifiers,
115
DeclarationModifiers
propertyModifiers,
142
DeclarationModifiers
propertyModifiers,
176
DeclarationModifiers
propertyModifiers,
222
private static (
DeclarationModifiers
, Flags) MakeModifiersAndFlags(
223
NamedTypeSymbol containingType, SourcePropertySymbolBase property,
DeclarationModifiers
propertyModifiers, Location location,
231
var
declarationModifiers = MakeModifiers(containingType, modifiers, isExplicitInterfaceImplementation, hasAnyBody, location, diagnostics, out modifierErrors);
234
declarationModifiers |= GetAccessorModifiers(propertyModifiers) & ~
DeclarationModifiers
.AccessibilityMask;
235
if ((declarationModifiers &
DeclarationModifiers
.Private) != 0)
238
declarationModifiers &= ~
DeclarationModifiers
.Virtual;
251
private static
DeclarationModifiers
GetAccessorModifiers(
DeclarationModifiers
propertyModifiers) =>
252
propertyModifiers & ~(
DeclarationModifiers
.Indexer |
DeclarationModifiers
.ReadOnly);
432
internal bool LocalDeclaredReadOnly => (DeclarationModifiers &
DeclarationModifiers
.ReadOnly) != 0;
492
private static
DeclarationModifiers
MakeModifiers(NamedTypeSymbol containingType, SyntaxTokenList modifiers, bool isExplicitInterfaceImplementation,
497
const
DeclarationModifiers
defaultAccess =
DeclarationModifiers
.None;
500
var
allowedModifiers = isExplicitInterfaceImplementation ?
DeclarationModifiers
.None :
DeclarationModifiers
.AccessibilityMask;
503
allowedModifiers |=
DeclarationModifiers
.ReadOnly;
506
var
defaultInterfaceImplementationModifiers =
DeclarationModifiers
.None;
511
defaultInterfaceImplementationModifiers =
DeclarationModifiers
.AccessibilityMask;
514
var
mods = ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: false, isForInterfaceMember: isInterface,
Symbols\Source\SourcePropertySymbol.cs (45)
69
bool allowAutoPropertyAccessors = (modifiers & (
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Extern |
DeclarationModifiers
.Indexer)) == 0 &&
70
(!containingType.IsInterface || hasGetAccessorImplementation || hasSetAccessorImplementation || (modifiers &
DeclarationModifiers
.Static) != 0) &&
71
((modifiers &
DeclarationModifiers
.Partial) == 0 || hasGetAccessorImplementation || hasSetAccessorImplementation);
109
DeclarationModifiers
modifiers,
358
private static (
DeclarationModifiers
modifiers, bool hasExplicitAccessMod) MakeModifiers(
369
var
defaultAccess = isInterface && !isExplicitInterfaceImplementation ?
DeclarationModifiers
.Public :
DeclarationModifiers
.Private;
372
var
allowedModifiers =
DeclarationModifiers
.Partial |
DeclarationModifiers
.Unsafe;
373
var
defaultInterfaceImplementationModifiers =
DeclarationModifiers
.None;
377
allowedModifiers |=
DeclarationModifiers
.New |
378
DeclarationModifiers
.Sealed |
379
DeclarationModifiers
.Abstract |
380
DeclarationModifiers
.Virtual |
381
DeclarationModifiers
.AccessibilityMask;
385
allowedModifiers |=
DeclarationModifiers
.Static;
390
allowedModifiers |=
DeclarationModifiers
.Override;
394
allowedModifiers |=
DeclarationModifiers
.Required;
401
defaultAccess =
DeclarationModifiers
.None;
403
defaultInterfaceImplementationModifiers |=
DeclarationModifiers
.Sealed |
404
DeclarationModifiers
.Abstract |
405
(isIndexer ? 0 :
DeclarationModifiers
.Static) |
406
DeclarationModifiers
.Virtual |
407
DeclarationModifiers
.Extern |
408
DeclarationModifiers
.AccessibilityMask;
417
allowedModifiers |=
DeclarationModifiers
.Abstract;
422
allowedModifiers |=
DeclarationModifiers
.Static;
428
allowedModifiers |=
DeclarationModifiers
.ReadOnly;
431
allowedModifiers |=
DeclarationModifiers
.Extern;
436
var
mods = ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: false, isForInterfaceMember: isInterface,
437
modifiers, defaultAccess:
DeclarationModifiers
.None, allowedModifiers, location, diagnostics, out modifierErrors);
438
if ((mods &
DeclarationModifiers
.AccessibilityMask) == 0)
448
if ((mods &
DeclarationModifiers
.Partial) != 0)
456
ModifierUtils.ReportUnsupportedModifiersForLanguageVersion(mods,
DeclarationModifiers
.Partial, location, diagnostics, availableVersion, requiredVersion);
477
mods |=
DeclarationModifiers
.Indexer;
480
if ((mods &
DeclarationModifiers
.Static) != 0 && (mods &
DeclarationModifiers
.Required) != 0)
484
mods &= ~
DeclarationModifiers
.Required;
730
if ((_modifiers &
DeclarationModifiers
.Unsafe) != (implementation._modifiers &
DeclarationModifiers
.Unsafe) && this.CompilationAllowsUnsafe()) // Don't cascade.
Symbols\Source\SourcePropertySymbolBase.cs (14)
48
protected readonly
DeclarationModifiers
_modifiers;
87
DeclarationModifiers
modifiers,
105
Debug.Assert((modifiers &
DeclarationModifiers
.Required) == 0 || this is SourcePropertySymbol);
544
get { return (_modifiers &
DeclarationModifiers
.Abstract) != 0; }
551
return (_modifiers &
DeclarationModifiers
.Extern) != 0;
565
get { return (_modifiers &
DeclarationModifiers
.Static) != 0; }
577
get { return (_modifiers &
DeclarationModifiers
.Indexer) != 0; }
582
get { return (_modifiers &
DeclarationModifiers
.Override) != 0; }
587
get { return (_modifiers &
DeclarationModifiers
.Sealed) != 0; }
592
get { return (_modifiers &
DeclarationModifiers
.Virtual) != 0; }
595
internal sealed override bool IsRequired => (_modifiers &
DeclarationModifiers
.Required) != 0;
599
get { return (_modifiers &
DeclarationModifiers
.New) != 0; }
602
internal bool HasReadOnlyModifier => (_modifiers &
DeclarationModifiers
.ReadOnly) != 0;
1724
internal bool IsPartial => (_modifiers &
DeclarationModifiers
.Partial) != 0;
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (33)
31
DeclarationModifiers
declarationModifiers,
125
protected static
DeclarationModifiers
MakeDeclarationModifiers(MethodKind methodKind, bool inInterface, BaseMethodDeclarationSyntax syntax, Location location, BindingDiagnosticBag diagnostics)
128
var
defaultAccess = inInterface && !isExplicitInterfaceImplementation ?
DeclarationModifiers
.Public :
DeclarationModifiers
.Private;
129
var
allowedModifiers =
130
DeclarationModifiers
.Static |
131
DeclarationModifiers
.Extern |
132
DeclarationModifiers
.Unsafe;
136
allowedModifiers |=
DeclarationModifiers
.AccessibilityMask;
140
allowedModifiers |=
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Virtual;
144
allowedModifiers |=
DeclarationModifiers
.Sealed;
151
allowedModifiers |=
DeclarationModifiers
.Abstract;
154
var
result = ModifierUtils.MakeAndCheckNonTypeMemberModifiers(
160
if ((result & (
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Virtual |
DeclarationModifiers
.Sealed)) != 0)
162
if ((result &
DeclarationModifiers
.Sealed) != 0 &&
163
(result & (
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Virtual)) != 0)
165
diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, ModifierUtils.ConvertSingleModifierToSyntaxText(
DeclarationModifiers
.Sealed));
166
result &= ~
DeclarationModifiers
.Sealed;
177
if ((result &
DeclarationModifiers
.Abstract) != 0)
179
reportModifierIfPresent(result,
DeclarationModifiers
.Abstract, location, diagnostics, requiredVersionArgument, availableVersionArgument);
183
reportModifierIfPresent(result,
DeclarationModifiers
.Virtual, location, diagnostics, requiredVersionArgument, availableVersionArgument);
186
reportModifierIfPresent(result,
DeclarationModifiers
.Sealed, location, diagnostics, requiredVersionArgument, availableVersionArgument);
189
result &= ~
DeclarationModifiers
.Sealed;
191
else if ((result &
DeclarationModifiers
.Static) != 0 && syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken))
199
if ((result &
DeclarationModifiers
.Abstract) != 0)
201
result |=
DeclarationModifiers
.Sealed;
207
static void reportModifierIfPresent(
DeclarationModifiers
result,
DeclarationModifiers
errorModifier, Location location, BindingDiagnosticBag diagnostics, CSharpRequiredLanguageVersion requiredVersionArgument, string availableVersionArgument)
Symbols\SymbolExtensions.cs (5)
291
internal static void CheckUnsafeModifier(this Symbol symbol,
DeclarationModifiers
modifiers, BindingDiagnosticBag diagnostics)
296
internal static void CheckUnsafeModifier(this Symbol symbol,
DeclarationModifiers
modifiers, Location errorLocation, BindingDiagnosticBag diagnostics)
299
internal static void CheckUnsafeModifier(this Symbol symbol,
DeclarationModifiers
modifiers, Location errorLocation, DiagnosticBag? diagnostics)
302
(modifiers &
DeclarationModifiers
.Unsafe) ==
DeclarationModifiers
.Unsafe &&
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (4)
36
private static (
DeclarationModifiers
, Flags) MakeModifiersAndFlags(SourceMemberContainerTypeSymbol containingType, TypeDeclarationSyntax syntax)
40
DeclarationModifiers
declarationModifiers = containingType.IsAbstract ?
DeclarationModifiers
.Protected :
DeclarationModifiers
.Public;
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (3)
20
: base(containingType, WellKnownMemberNames.ObjectEquals, memberOffset,
DeclarationModifiers
.Public |
DeclarationModifiers
.Override |
DeclarationModifiers
.Sealed)
Symbols\Synthesized\Records\SynthesizedRecordClone.cs (18)
30
private static
DeclarationModifiers
MakeDeclarationModifiers(SourceMemberContainerTypeSymbol containingType)
32
DeclarationModifiers
result =
DeclarationModifiers
.Public;
36
result |=
DeclarationModifiers
.Override;
40
result |= containingType.IsSealed ?
DeclarationModifiers
.None :
DeclarationModifiers
.Virtual;
45
result &= ~
DeclarationModifiers
.Virtual;
46
result |=
DeclarationModifiers
.Abstract;
55
static bool modifiersAreValid(
DeclarationModifiers
modifiers)
57
if ((modifiers &
DeclarationModifiers
.AccessibilityMask) !=
DeclarationModifiers
.Public)
62
modifiers &= ~
DeclarationModifiers
.AccessibilityMask;
66
case
DeclarationModifiers
.None:
68
case
DeclarationModifiers
.Abstract:
70
case
DeclarationModifiers
.Override:
72
case
DeclarationModifiers
.Abstract |
DeclarationModifiers
.Override:
74
case
DeclarationModifiers
.Virtual:
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (2)
24
DeclarationModifiers
.Public | (IsReadOnly(containingType, positionalMembers) ?
DeclarationModifiers
.ReadOnly : 0))
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (6)
29
(true, true) =>
DeclarationModifiers
.Private,
30
(false, true) =>
DeclarationModifiers
.Protected |
DeclarationModifiers
.Virtual,
31
(_, false) =>
DeclarationModifiers
.Protected |
DeclarationModifiers
.Override
136
DeclarationModifiers
propertyModifiers,
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperatorBase.cs (2)
40
DeclarationModifiers
.Public |
DeclarationModifiers
.Static, hasAnyBody: true, isExpressionBodied: false, isIterator: false, isNullableAnalysisEnabled: false, diagnostics)
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (3)
23
DeclarationModifiers
.Public |
24
(containingType.IsSealed ? 0 :
DeclarationModifiers
.Virtual) |
25
(containingType.IsRecordStruct ?
DeclarationModifiers
.ReadOnly : 0))
Symbols\Synthesized\Records\SynthesizedRecordObjectMethod.cs (3)
16
DeclarationModifiers
.Public |
DeclarationModifiers
.Override | (isReadOnly ?
DeclarationModifiers
.ReadOnly : 0))
Symbols\Synthesized\Records\SynthesizedRecordOrdinaryMethod.cs (1)
23
protected SynthesizedRecordOrdinaryMethod(SourceMemberContainerTypeSymbol containingType, string name, int memberOffset,
DeclarationModifiers
declarationModifiers)
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (18)
35
private static
DeclarationModifiers
MakeDeclarationModifiers(SourceMemberContainerTypeSymbol containingType, IEnumerable<Symbol> userDefinedMembers)
37
var
result = (containingType.IsRecordStruct || (containingType.BaseTypeNoUseSiteDiagnostics.IsObjectType() && containingType.IsSealed)) ?
38
DeclarationModifiers
.Private :
39
DeclarationModifiers
.Protected;
43
result |=
DeclarationModifiers
.Override;
47
result |= containingType.IsSealed ?
DeclarationModifiers
.None :
DeclarationModifiers
.Virtual;
55
result |=
DeclarationModifiers
.ReadOnly;
61
bool modifiersAreValid(
DeclarationModifiers
modifiers)
65
return modifiers ==
DeclarationModifiers
.Private;
68
if ((modifiers &
DeclarationModifiers
.AccessibilityMask) !=
DeclarationModifiers
.Private &&
69
(modifiers &
DeclarationModifiers
.AccessibilityMask) !=
DeclarationModifiers
.Protected)
74
modifiers &= ~
DeclarationModifiers
.AccessibilityMask;
78
case
DeclarationModifiers
.None:
79
case
DeclarationModifiers
.Override:
80
case
DeclarationModifiers
.Virtual:
Symbols\Synthesized\Records\SynthesizedRecordPropertySymbol.cs (3)
30
modifiers:
DeclarationModifiers
.Public | (isOverride ?
DeclarationModifiers
.Override :
DeclarationModifiers
.None),
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (6)
24
protected override
DeclarationModifiers
Modifiers { get; }
35
Modifiers =
DeclarationModifiers
.Private |
36
(isReadOnly ?
DeclarationModifiers
.ReadOnly :
DeclarationModifiers
.None) |
37
(isStatic ?
DeclarationModifiers
.Static :
DeclarationModifiers
.None);
Symbols\Synthesized\SynthesizedFieldSymbolBase.cs (9)
22
private readonly
DeclarationModifiers
_modifiers;
36
_modifiers = (isPublic ?
DeclarationModifiers
.Public :
DeclarationModifiers
.Private) |
37
(isReadOnly ?
DeclarationModifiers
.ReadOnly :
DeclarationModifiers
.None) |
38
(isStatic ?
DeclarationModifiers
.Static :
DeclarationModifiers
.None);
107
get { return (_modifiers &
DeclarationModifiers
.ReadOnly) != 0; }
178
get { return (_modifiers &
DeclarationModifiers
.Static) != 0; }
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (6)
62
private static (
DeclarationModifiers
, Flags) MakeModifiersAndFlags(SourceMemberContainerTypeSymbol containingType, SingleTypeDeclaration declaration)
67
DeclarationModifiers
declarationModifiers =
DeclarationModifiers
.Static |
DeclarationModifiers
.Private | (hasAwait ?
DeclarationModifiers
.Async :
DeclarationModifiers
.None);