/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/CSharp/Portable/Syntax/SyntaxBindingUtilities.cs
27 строк
1 KB
Tomáš Matoušek
EnC: Allow adding/removing await expressions and yield statements (#61356)
31 май 2022, 22:39
Не верифицирован
31 май 2022, 22:39
09c2744
Код
Авторство
О чём код?
// 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; using System.Collections.Generic; using System.Text; namespace Microsoft.CodeAnalysis.CSharp.Syntax { internal static class SyntaxBindingUtilities { public static bool BindsToResumableStateMachineState(SyntaxNode node) => node.IsKind(SyntaxKind.YieldReturnStatement) || node.IsKind(SyntaxKind.AwaitExpression) || node is CommonForEachStatementSyntax { AwaitKeyword.RawKind: not 0 } or VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { AwaitKeyword.RawKind: not 0 } or LocalDeclarationStatementSyntax { AwaitKeyword.RawKind: not 0 } } or UsingStatementSyntax { Expression: not null, AwaitKeyword.RawKind: not 0 }; public static bool BindsToTryStatement(SyntaxNode node) => node is VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { } or LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not 0 } } or UsingStatementSyntax { Expression: not null } or CommonForEachStatementSyntax or TryStatementSyntax or LockStatementSyntax; } }