/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/CSharp/Portable/Declarations/DeclarationKind.cs
54 строки
2 KB
AlekseyTs
Initial support for union declarations (#82500)
25 фев 2026, 22:37
Не верифицирован
25 фев 2026, 22:37
49a4215
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp { internal enum DeclarationKind : byte { Namespace, Class, Interface, Struct, Enum, Delegate, Script, Submission, ImplicitClass, Record, RecordStruct, Extension, Union, } internal static partial class EnumConversions { internal static DeclarationKind ToDeclarationKind(this SyntaxKind kind) { switch (kind) { case SyntaxKind.ClassDeclaration: return DeclarationKind.Class; case SyntaxKind.InterfaceDeclaration: return DeclarationKind.Interface; case SyntaxKind.StructDeclaration: return DeclarationKind.Struct; case SyntaxKind.UnionDeclaration: return DeclarationKind.Union; case SyntaxKind.NamespaceDeclaration: case SyntaxKind.FileScopedNamespaceDeclaration: return DeclarationKind.Namespace; case SyntaxKind.EnumDeclaration: return DeclarationKind.Enum; case SyntaxKind.DelegateDeclaration: return DeclarationKind.Delegate; case SyntaxKind.RecordDeclaration: return DeclarationKind.Record; case SyntaxKind.RecordStructDeclaration: return DeclarationKind.RecordStruct; case SyntaxKind.ExtensionBlockDeclaration: return DeclarationKind.Extension; default: throw ExceptionUtilities.UnexpectedValue(kind); } } } }