/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/SpacingWithinParentheses.cs
33 строки
2 KB
Tomáš Matoušek
Fix flag value in option fallback reader (#66967)
22 фев 2023, 21:37
Не верифицирован
22 фев 2023, 21:37
7347efa
Код
Авторство
О чём код?
// 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. using System; namespace Microsoft.CodeAnalysis.CSharp.Formatting; [Flags] internal enum SpacePlacementWithinParentheses { None = 0, Expressions = 1, TypeCasts = 1 << 1, ControlFlowStatements = 1 << 2, All = (1 << 3) - 1 } internal static partial class Extensions { public static SpacePlacementWithinParentheses ToSpacingWithinParentheses(this SpacePlacement placement) => (placement.HasFlag(SpacePlacement.WithinExpressionParentheses) ? SpacePlacementWithinParentheses.Expressions : 0) | (placement.HasFlag(SpacePlacement.WithinCastParentheses) ? SpacePlacementWithinParentheses.TypeCasts : 0) | (placement.HasFlag(SpacePlacement.WithinOtherParentheses) ? SpacePlacementWithinParentheses.ControlFlowStatements : 0); public static SpacePlacement ToSpacePlacement(this SpacePlacementWithinParentheses placement) => (placement.HasFlag(SpacePlacementWithinParentheses.Expressions) ? SpacePlacement.WithinExpressionParentheses : 0) | (placement.HasFlag(SpacePlacementWithinParentheses.TypeCasts) ? SpacePlacement.WithinCastParentheses : 0) | (placement.HasFlag(SpacePlacementWithinParentheses.ControlFlowStatements) ? SpacePlacement.WithinOtherParentheses : 0); public static SpacePlacementWithinParentheses WithFlagValue(this SpacePlacementWithinParentheses flags, SpacePlacementWithinParentheses flag, bool value) => (flags & ~flag) | (value ? flag : 0); }