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