154 references to UnsafeKeyword
Microsoft.CodeAnalysis.CSharp (16)
Binder\Binder_Flags.cs (1)
109
return !withoutUnsafe && modifiers.Any(SyntaxKind.
UnsafeKeyword
)
Parser\LanguageParser.cs (11)
355
case SyntaxKind.
UnsafeKeyword
:
965
var unsafeToken = this.TryEatToken(SyntaxKind.
UnsafeKeyword
);
1324
case SyntaxKind.
UnsafeKeyword
:
2336
case SyntaxKind.
UnsafeKeyword
:
2505
case SyntaxKind.
UnsafeKeyword
:
7999
case SyntaxKind.
UnsafeKeyword
:
8811
case SyntaxKind.
UnsafeKeyword
:
9849
Debug.Assert(this.CurrentToken.Kind == SyntaxKind.
UnsafeKeyword
);
9852
this.EatToken(SyntaxKind.
UnsafeKeyword
),
10390
case SyntaxKind.
UnsafeKeyword
:
10458
case SyntaxKind.
UnsafeKeyword
:
Symbols\Source\ModifierUtils.cs (2)
310
return SyntaxFacts.GetText(SyntaxKind.
UnsafeKeyword
);
360
case SyntaxKind.
UnsafeKeyword
:
Syntax\SyntaxKindFacts.cs (2)
1007
return SyntaxKind.
UnsafeKeyword
;
1655
case SyntaxKind.
UnsafeKeyword
:
Microsoft.CodeAnalysis.CSharp.CodeStyle (5)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (1)
94
public static readonly SyntaxToken UnsafeKeyword = Token(SyntaxKind.
UnsafeKeyword
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (1)
167
SyntaxKind.
UnsafeKeyword
,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
330
m => m.GetModifiers().Any(SyntaxKind.
UnsafeKeyword
));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
96
case SyntaxKind.
UnsafeKeyword
:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
139
SyntaxKind.
UnsafeKeyword
=> DeclarationModifiers.Unsafe,
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (9)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (4)
47
if (token.IsKind(SyntaxKind.
UnsafeKeyword
) &&
506
targetToken.GetAncestors<MemberDeclarationSyntax>().Any(m => m.GetModifiers().Any(SyntaxKind.
UnsafeKeyword
) ||
507
targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.
UnsafeKeyword
))) ||
508
targetToken.GetAncestors<UsingDirectiveSyntax>().Any(d => d.UnsafeKeyword.IsKind(SyntaxKind.
UnsafeKeyword
));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
25
SyntaxKind.
UnsafeKeyword
,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
101
if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.
UnsafeKeyword
)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\SyntaxKindSet.cs (3)
22
SyntaxKind.
UnsafeKeyword
,
42
SyntaxKind.
UnsafeKeyword
,
57
SyntaxKind.
UnsafeKeyword
,
Microsoft.CodeAnalysis.CSharp.Features (49)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
560
case SyntaxKind.
UnsafeKeyword
:
Completion\CompletionProviders\OverrideCompletionProvider.cs (1)
139
case SyntaxKind.
UnsafeKeyword
:
Completion\KeywordRecommenders\AbstractKeywordRecommender.cs (3)
21
SyntaxKind.
UnsafeKeyword
,
33
SyntaxKind.
UnsafeKeyword
,
44
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\AsyncKeywordRecommender.cs (1)
23
SyntaxKind.
UnsafeKeyword
Completion\KeywordRecommenders\ClassKeywordRecommender.cs (1)
24
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\DelegateKeywordRecommender.cs (1)
21
SyntaxKind.
UnsafeKeyword
Completion\KeywordRecommenders\EventKeywordRecommender.cs (1)
28
SyntaxKind.
UnsafeKeyword
Completion\KeywordRecommenders\ExplicitKeywordRecommender.cs (2)
19
SyntaxKind.
UnsafeKeyword
,
27
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\ExternKeywordRecommender.cs (3)
25
SyntaxKind.
UnsafeKeyword
,
36
SyntaxKind.
UnsafeKeyword
,
42
SyntaxKind.
UnsafeKeyword
Completion\KeywordRecommenders\FixedKeywordRecommender.cs (1)
21
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\ImplicitKeywordRecommender.cs (2)
19
SyntaxKind.
UnsafeKeyword
,
27
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\InterfaceKeywordRecommender.cs (1)
20
SyntaxKind.
UnsafeKeyword
Completion\KeywordRecommenders\NewKeywordRecommender.cs (2)
28
SyntaxKind.
UnsafeKeyword
,
42
SyntaxKind.
UnsafeKeyword
Completion\KeywordRecommenders\OverrideKeywordRecommender.cs (1)
21
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\RecordKeywordRecommender.cs (1)
24
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\RefKeywordRecommender.cs (3)
39
SyntaxKind.
UnsafeKeyword
,
58
SyntaxKind.
UnsafeKeyword
,
76
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\SealedKeywordRecommender.cs (3)
22
SyntaxKind.
UnsafeKeyword
,
34
SyntaxKind.
UnsafeKeyword
,
44
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\StaticKeywordRecommender.cs (5)
22
SyntaxKind.
UnsafeKeyword
,
36
SyntaxKind.
UnsafeKeyword
,
52
SyntaxKind.
UnsafeKeyword
,
65
SyntaxKind.
UnsafeKeyword
,
73
SyntaxKind.
UnsafeKeyword
Completion\KeywordRecommenders\StructKeywordRecommender.cs (1)
21
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\UnsafeKeywordRecommender.cs (1)
64
: base(SyntaxKind.
UnsafeKeyword
)
Completion\KeywordRecommenders\VirtualKeywordRecommender.cs (2)
22
SyntaxKind.
UnsafeKeyword
,
34
SyntaxKind.
UnsafeKeyword
,
Completion\KeywordRecommenders\VoidKeywordRecommender.cs (1)
28
SyntaxKind.
UnsafeKeyword
,
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
198
modifiers: [.. otherMethod.Modifiers.Where(m => m.Kind() is SyntaxKind.AsyncKeyword or SyntaxKind.
UnsafeKeyword
)],
ExtractMethod\CSharpSelectionResult.cs (1)
221
.Any(m => m.GetModifiers().Any(SyntaxKind.
UnsafeKeyword
)))
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (2)
138
if (setMethodDeclaration?.Modifiers.Any(SyntaxKind.
UnsafeKeyword
) == true
139
&& !property.Modifiers.Any(SyntaxKind.
UnsafeKeyword
))
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (4)
131
if (propertyDeclaration.Modifiers.Any(SyntaxKind.
UnsafeKeyword
)
132
&& !methodDeclaration.Modifiers.Any(SyntaxKind.
UnsafeKeyword
))
186
if (propertyDeclaration.Modifiers.Any(SyntaxKind.
UnsafeKeyword
)
187
&& !methodDeclaration.Modifiers.Any(SyntaxKind.
UnsafeKeyword
))
Snippets\CSharpClassSnippetProvider.cs (1)
35
SyntaxKind.
UnsafeKeyword
,
Snippets\CSharpInterfaceSnippetProvider.cs (1)
31
SyntaxKind.
UnsafeKeyword
,
Snippets\CSharpStructSnippetProvider.cs (1)
31
SyntaxKind.
UnsafeKeyword
,
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (48)
Generated\Syntax.Test.xml.Generated.cs (4)
416
=> InternalSyntaxFactory.UnsafeStatement(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList<Syntax.InternalSyntax.AttributeListSyntax>(), InternalSyntaxFactory.Token(SyntaxKind.
UnsafeKeyword
), GenerateBlock());
2384
Assert.Equal(SyntaxKind.
UnsafeKeyword
, node.UnsafeKeyword.Kind);
10632
=> SyntaxFactory.UnsafeStatement(new SyntaxList<AttributeListSyntax>(), SyntaxFactory.Token(SyntaxKind.
UnsafeKeyword
), GenerateBlock());
12600
Assert.Equal(SyntaxKind.
UnsafeKeyword
, node.UnsafeKeyword.Kind());
Parsing\FileModifierParsingTests.cs (2)
1597
N(SyntaxKind.
UnsafeKeyword
);
1861
N(SyntaxKind.
UnsafeKeyword
);
Parsing\ScriptParsingTests.cs (5)
968
NewModifier_WithOtherModifier("unsafe", SyntaxKind.
UnsafeKeyword
);
1212
N(SyntaxKind.
UnsafeKeyword
);
1234
N(SyntaxKind.
UnsafeKeyword
);
1262
N(SyntaxKind.
UnsafeKeyword
);
1293
N(SyntaxKind.
UnsafeKeyword
);
Parsing\StatementAttributeParsingTests.cs (3)
1592
N(SyntaxKind.
UnsafeKeyword
);
1948
N(SyntaxKind.
UnsafeKeyword
);
2021
N(SyntaxKind.
UnsafeKeyword
);
Parsing\StatementParsingTests.cs (1)
1463
Assert.Equal(SyntaxKind.
UnsafeKeyword
, us.UnsafeKeyword.Kind());
Parsing\UsingDirectiveParsingTests.cs (31)
672
N(SyntaxKind.
UnsafeKeyword
);
784
N(SyntaxKind.
UnsafeKeyword
);
844
N(SyntaxKind.
UnsafeKeyword
);
1121
N(SyntaxKind.
UnsafeKeyword
);
1169
N(SyntaxKind.
UnsafeKeyword
);
1241
N(SyntaxKind.
UnsafeKeyword
);
1271
N(SyntaxKind.
UnsafeKeyword
);
1346
N(SyntaxKind.
UnsafeKeyword
);
1392
N(SyntaxKind.
UnsafeKeyword
);
1476
N(SyntaxKind.
UnsafeKeyword
);
1506
N(SyntaxKind.
UnsafeKeyword
);
2106
N(SyntaxKind.
UnsafeKeyword
);
2180
N(SyntaxKind.
UnsafeKeyword
);
2206
N(SyntaxKind.
UnsafeKeyword
);
2283
N(SyntaxKind.
UnsafeKeyword
);
4061
N(SyntaxKind.
UnsafeKeyword
);
4108
N(SyntaxKind.
UnsafeKeyword
);
4155
N(SyntaxKind.
UnsafeKeyword
);
4199
N(SyntaxKind.
UnsafeKeyword
);
4252
N(SyntaxKind.
UnsafeKeyword
);
4310
N(SyntaxKind.
UnsafeKeyword
);
4368
N(SyntaxKind.
UnsafeKeyword
);
4423
N(SyntaxKind.
UnsafeKeyword
);
4474
N(SyntaxKind.
UnsafeKeyword
);
4514
N(SyntaxKind.
UnsafeKeyword
);
4554
N(SyntaxKind.
UnsafeKeyword
);
4591
N(SyntaxKind.
UnsafeKeyword
);
4634
N(SyntaxKind.
UnsafeKeyword
);
4715
N(SyntaxKind.
UnsafeKeyword
);
4796
N(SyntaxKind.
UnsafeKeyword
);
4874
N(SyntaxKind.
UnsafeKeyword
);
Syntax\SyntaxNodeTests.cs (2)
3466
var newModifiers = method.Modifiers.Add(SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.
UnsafeKeyword
, SyntaxFactory.TriviaList(SyntaxFactory.Space)));
3470
Assert.Equal(SyntaxKind.
UnsafeKeyword
, newModifiers[1].Kind());
Microsoft.CodeAnalysis.CSharp.Workspaces (14)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (1)
94
public static readonly SyntaxToken UnsafeKeyword = Token(SyntaxKind.
UnsafeKeyword
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (1)
167
SyntaxKind.
UnsafeKeyword
,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
330
m => m.GetModifiers().Any(SyntaxKind.
UnsafeKeyword
));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
96
case SyntaxKind.
UnsafeKeyword
:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
139
SyntaxKind.
UnsafeKeyword
=> DeclarationModifiers.Unsafe,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (4)
47
if (token.IsKind(SyntaxKind.
UnsafeKeyword
) &&
506
targetToken.GetAncestors<MemberDeclarationSyntax>().Any(m => m.GetModifiers().Any(SyntaxKind.
UnsafeKeyword
) ||
507
targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.
UnsafeKeyword
))) ||
508
targetToken.GetAncestors<UsingDirectiveSyntax>().Any(d => d.UnsafeKeyword.IsKind(SyntaxKind.
UnsafeKeyword
));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
25
SyntaxKind.
UnsafeKeyword
,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
101
if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.
UnsafeKeyword
)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\SyntaxKindSet.cs (3)
22
SyntaxKind.
UnsafeKeyword
,
42
SyntaxKind.
UnsafeKeyword
,
57
SyntaxKind.
UnsafeKeyword
,
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
CodeGeneration\CodeGenerationTests.cs (1)
776
yield return CS.SyntaxFactory.Token(CS.SyntaxKind.
UnsafeKeyword
);
Microsoft.Interop.ComInterfaceGenerator (4)
ComClassGenerator.cs (1)
85
Token(SyntaxKind.
UnsafeKeyword
))
ComInterfaceGenerator.cs (2)
479
.WithModifiers(TokenList(Token(SyntaxKind.FileKeyword), Token(SyntaxKind.
UnsafeKeyword
), Token(SyntaxKind.PartialKeyword)));
631
.AddModifiers(Token(SyntaxKind.FileKeyword), Token(SyntaxKind.
UnsafeKeyword
))
VtableIndexStubGenerator.cs (1)
443
.WithModifiers(TokenList(Token(SyntaxKind.InternalKeyword), Token(SyntaxKind.StaticKeyword), Token(SyntaxKind.
UnsafeKeyword
)))
Microsoft.Interop.JavaScript.JSImportGenerator (2)
JSExportGenerator.cs (2)
145
.WithModifiers(TokenList(new[] { Token(SyntaxKind.InternalKeyword), Token(SyntaxKind.StaticKeyword), Token(SyntaxKind.
UnsafeKeyword
) }))
296
Token(SyntaxKind.
UnsafeKeyword
)}))
Microsoft.Interop.LibraryImportGenerator (1)
LibraryImportGenerator.cs (1)
446
Token(SyntaxKind.
UnsafeKeyword
))
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
DownlevelLibraryImportGenerator.cs (1)
322
Token(SyntaxKind.
UnsafeKeyword
))
Microsoft.Interop.SourceGeneration (2)
ContainingSyntaxContext.cs (2)
112
type = type.WithModifiers(type.Modifiers.AddToModifiers(SyntaxKind.
UnsafeKeyword
));
138
type = type.WithModifiers(type.Modifiers.AddToModifiers(SyntaxKind.
UnsafeKeyword
));
Microsoft.VisualStudio.LanguageServices.CSharp (2)
CodeModel\ModifierFlagsExtensions.cs (2)
33
{ ModifierFlags.Unsafe, SyntaxKind.
UnsafeKeyword
},
88
case SyntaxKind.
UnsafeKeyword
: