/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/CSharp/Portable/Lowering/Instrumentation/InstrumentationState.cs
34 строки
1 KB
Tomáš Matoušek
Instrumentation state (#66429)
30 янв 2023, 22:41
Не верифицирован
30 янв 2023, 22:41
c29e198
Код
Авторство
О чём код?
// 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. namespace Microsoft.CodeAnalysis.CSharp; /// <summary> /// Manages instrumentation state. /// </summary> internal sealed class InstrumentationState { /// <summary> /// Used to temporarily suspend instrumentation, for example when lowering expression tree. /// </summary> public bool IsSuppressed { get; set; } /// <summary> /// Current instrumenter. /// </summary> public Instrumenter Instrumenter { get; set; } = Instrumenter.NoOp; public void RemoveCodeCoverageInstrumenter() { Instrumenter = recurse(Instrumenter); static Instrumenter recurse(Instrumenter instrumenter) => instrumenter switch { CodeCoverageInstrumenter { Previous: var previous } => recurse(previous), CompoundInstrumenter compound => compound.WithPrevious(recurse(compound.Previous)), _ => instrumenter, }; } }