/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/CSharp/Portable/BoundTree/BoundStatementExtensions.cs
57 строк
2 KB
Julien Couvreur
Warn for multiple blank lines in source (#65451)
17 ноя 2022, 22:55
Не верифицирован
17 ноя 2022, 22:55
a8824e8
Код
Авторство
О чём код?
// 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.Diagnostics; using Microsoft.CodeAnalysis.CSharp.Symbols; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp { internal static partial class BoundStatementExtensions { [Conditional("DEBUG")] internal static void AssertIsLabeledStatement(this BoundStatement node) { switch (node.Kind) { case BoundKind.LabelStatement: case BoundKind.LabeledStatement: case BoundKind.SwitchSection: break; default: throw ExceptionUtilities.UnexpectedValue(node.Kind); } } [Conditional("DEBUG")] internal static void AssertIsLabeledStatementWithLabel(this BoundStatement node, LabelSymbol label) { Debug.Assert(node != null); switch (node.Kind) { case BoundKind.LabelStatement: Debug.Assert(((BoundLabelStatement)node).Label == label); break; case BoundKind.LabeledStatement: Debug.Assert(((BoundLabeledStatement)node).Label == label); break; case BoundKind.SwitchSection: foreach (var boundSwitchLabel in ((BoundSwitchSection)node).SwitchLabels) { if (boundSwitchLabel.Label == label) { return; } } throw ExceptionUtilities.Unreachable(); default: throw ExceptionUtilities.UnexpectedValue(node.Kind); } } } }