/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/CSharp/Portable/Symbols/RefKindExtensions.cs
54 строки
2 KB
Jan Jones
Emit modopt for ref readonly parameters in function pointers (#68728)
14 июл 2023, 13:19
Не верифицирован
14 июл 2023, 13:19
66a5b66
Код
Авторство
О чём код?
// 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 System.Diagnostics; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols { internal static partial class RefKindExtensions { public static bool IsManagedReference(this RefKind refKind) { Debug.Assert(refKind <= RefKind.RefReadOnly); return refKind != RefKind.None; } public static RefKind GetRefKind(this SyntaxKind syntaxKind) { switch (syntaxKind) { case SyntaxKind.RefKeyword: return RefKind.Ref; case SyntaxKind.OutKeyword: return RefKind.Out; case SyntaxKind.InKeyword: return RefKind.In; case SyntaxKind.None: return RefKind.None; default: throw ExceptionUtilities.UnexpectedValue(syntaxKind); } } public static bool IsWritableReference(this RefKind refKind) { switch (refKind) { case RefKind.Ref: case RefKind.Out: return true; case RefKind.None: case RefKind.In: case RefKind.RefReadOnlyParameter: return false; default: throw ExceptionUtilities.UnexpectedValue(refKind); } } } }