1 implementation of IBlockOperation
Microsoft.CodeAnalysis (1)
Generated\Operations.Generated.cs (1)
3999internal sealed partial class BlockOperation : Operation, IBlockOperation
190 references to IBlockOperation
Microsoft.AspNetCore.App.Analyzers (8)
Authorization\AddAuthorizationBuilderAnalyzer.cs (4)
73&& TryGetConfigureBlockOperation(configureAnonymousFunctionOperation, out var configureBlockOperation)) 129private static bool TryGetConfigureBlockOperation(IAnonymousFunctionOperation configureAnonymousFunctionOperation, [NotNullWhen(true)] out IBlockOperation? configureBlockOperation) 134&& anonymousFunctionChildOperations.First() is IBlockOperation blockOperation) 163private static bool IsConfigureActionCompatibleWithAuthorizationBuilder(IBlockOperation configureAction, AuthorizationOptionsTypes authorizationOptionsTypes)
RouteHandlers\DetectAmbiguousRoutes.cs (1)
70if (current.Parent is IBlockOperation or ISwitchCaseOperation)
RouteHandlers\DetectMisplacedLambdaAttribute.cs (2)
28if (lambda.ChildOperations.Count != 1 || lambda.ChildOperations.FirstOrDefault() is not IBlockOperation blockOperation) 71static IMethodSymbol? GetReturnedInvocation(IBlockOperation blockOperation)
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (1)
31IBlockOperation? methodBody,
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (1)
215return statement is IBlockOperation block && block.Operations.Length == 1 ?
Microsoft.CodeAnalysis (37)
Generated\OperationKind.Generated.cs (1)
21/// <summary>Indicates an <see cref="IBlockOperation"/>.</summary>
Generated\Operations.Generated.cs (32)
478IBlockOperation Body { get; } 486IBlockOperation? Finally { get; } 584IBlockOperation? Body { get; } 591IBlockOperation? IgnoredBody { get; } 1254IBlockOperation Body { get; } 2624IBlockOperation Handler { get; } 3004IBlockOperation? BlockBody { get; } 3008IBlockOperation? ExpressionBody { get; } 3459/// Represents using variable declaration, with scope spanning across the parent <see cref="IBlockOperation" />. 4720internal TryOperation(IBlockOperation body, ImmutableArray<ICatchClauseOperation> catches, IBlockOperation? @finally, ILabelSymbol? exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4728public IBlockOperation Body { get; } 4730public IBlockOperation? Finally { get; } 4918internal LocalFunctionOperation(IMethodSymbol symbol, IBlockOperation? body, IBlockOperation? ignoredBody, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4926public IBlockOperation? Body { get; } 4927public IBlockOperation? IgnoredBody { get; } 5864internal AnonymousFunctionOperation(IMethodSymbol symbol, IBlockOperation body, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 5871public IBlockOperation Body { get; } 7975internal CatchClauseOperation(IOperation? exceptionDeclarationOrExpression, ITypeSymbol exceptionType, ImmutableArray<ILocalSymbol> locals, IOperation? filter, IBlockOperation handler, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7988public IBlockOperation Handler { get; } 8657protected BaseMethodBodyBaseOperation(IBlockOperation? blockBody, IBlockOperation? expressionBody, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8663public IBlockOperation? BlockBody { get; } 8664public IBlockOperation? ExpressionBody { get; } 8668internal MethodBodyOperation(IBlockOperation? blockBody, IBlockOperation? expressionBody, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8724internal ConstructorBodyOperation(ImmutableArray<ILocalSymbol> locals, IOperation? initializer, IBlockOperation? blockBody, IBlockOperation? expressionBody, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10796public override IOperation VisitBlock(IBlockOperation operation, object? argument) 11416public virtual void VisitBlock(IBlockOperation operation) => DefaultVisit(operation); 11555public virtual TResult? VisitBlock(IBlockOperation operation, TArgument argument) => DefaultVisit(operation, argument);
Operations\ControlFlowGraph.cs (1)
105public static ControlFlowGraph Create(Operations.IBlockOperation body, CancellationToken cancellationToken = default)
Operations\ControlFlowGraphBuilder.cs (3)
1383public override IOperation? VisitBlock(IBlockOperation operation, int? captureIdForResult) 1511private void VisitMethodBodies(IBlockOperation? blockBody, IBlockOperation? expressionBody)
Microsoft.CodeAnalysis.CodeStyle (9)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (2)
60if (operation is not IBlockOperation blockOperation) 77while (blockOperation.Operations is [IBlockOperation childBlock])
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (1)
49if (ifOperation.Parent is not IBlockOperation parentBlock)
src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (1)
60=> statement is IBlockOperation { Operations: [var operationInBlock] }
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (4)
104if (ifOperation.Parent is not IBlockOperation containingBlock) 139private static bool ValueIsAccessed(SemanticModel semanticModel, IConditionalOperation ifOperation, IBlockOperation containingBlock, ISymbol localOrParameter, IExpressionStatementOperation expressionStatement, IAssignmentOperation assignmentExpression) 168IBlockOperation containingBlock, IConditionalOperation ifOperation, ISymbol localOrParameter, 276if (containingOperation is IBlockOperation block)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
406if (firstBlock is not IBlockOperation block)
Microsoft.CodeAnalysis.CodeStyle.Fixes (12)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
187if (ifOperation.Parent is not IBlockOperation parentBlock)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (7)
27protected abstract SyntaxNode? TryGetLastStatement(IBlockOperation? blockStatement); 29protected abstract bool TryUpdateTupleAssignment(IBlockOperation? blockStatement, IParameterSymbol parameter, ISymbol fieldOrProperty, SyntaxEditor editor); 41out IBlockOperation? blockStatement) 70blockStatement = (IBlockOperation)operation; 121if (TryGetBlockForSingleParameterInitialization(functionDeclaration, semanticModel, syntaxFacts, cancellationToken, out var blockStatementOpt)) 136IBlockOperation? blockStatement, 165IParameterSymbol parameter, IBlockOperation? blockStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\IInitializeParameterService.cs (1)
29out IBlockOperation? blockStatement);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (2)
76public static IOperation? TryFindFieldOrPropertyAssignmentStatement(IParameterSymbol parameter, IBlockOperation? blockStatement) 80IParameterSymbol parameter, IBlockOperation? blockStatement, out ISymbol? fieldOrProperty)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
36while (rootOperation is not IBlockOperation &&
Microsoft.CodeAnalysis.CSharp (17)
Operations\CSharpOperationFactory.cs (17)
354(IBlockOperation?)Create(boundNode.BlockBody), 355(IBlockOperation?)Create(boundNode.ExpressionBody), 366(IBlockOperation?)Create(boundNode.BlockBody), 367(IBlockOperation?)Create(boundNode.ExpressionBody), 997IBlockOperation body = (IBlockOperation)Create(boundLambda.Body); 1005IBlockOperation? body = (IBlockOperation?)Create(boundLocalFunctionStatement.Body); 1006IBlockOperation? ignoredBody = boundLocalFunctionStatement is { BlockBody: { }, ExpressionBody: { } exprBody } 1007? (IBlockOperation?)Create(exprBody) 1751private IBlockOperation CreateBoundBlockOperation(BoundBlock boundBlock) 1997var body = (IBlockOperation)Create(boundTryStatement.TryBlock); 1999var @finally = (IBlockOperation?)Create(boundTryStatement.FinallyBlockOpt); 2011IBlockOperation handler = (IBlockOperation)Create(boundCatchBlock.Body);
Microsoft.CodeAnalysis.CSharp.CodeStyle (4)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
151if (blockOperation is IBlockOperation { Operations: [IThrowOperation or IExpressionStatementOperation { Operation: IThrowOperation }] })
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
78=> expressionStatementOperation.Parent is IBlockOperation blockOperation &&
src\Analyzers\CSharp\Analyzers\UseConditionalExpression\CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer.cs (1)
36if (statement is not IReturnOperation { Parent: IBlockOperation block })
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
158if (innerUsingOperation.Body is IBlockOperation innerUsingBlock)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (12)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (8)
38GetBlockOfMethodBody(methodBodyOperation) is IBlockOperation 114return GetBlockOfMethodBody(operation) is IBlockOperation 133if (GetBlockOfMethodBody(operation) is not IBlockOperation 423var body = GetBlockOfMethodBody(constructorOperation); 499var body = GetBlockOfMethodBody(operation); 1065var trueOps = ((whenTrue as IBlockOperation)?.Operations ?? [whenTrue]) 1067var falseOps = ((whenFalse as IBlockOperation)?.Operations ?? 1122private static IBlockOperation? GetBlockOfMethodBody(IMethodBodyBaseOperation body)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\CSharpInitializeParameterService.cs (3)
34protected override SyntaxNode? TryGetLastStatement(IBlockOperation? blockStatement) 41IBlockOperation? blockStatement, 100private static IEnumerable<(ITupleOperation targetTuple, ITupleOperation valueTuple)> TryGetAssignmentExpressions(IBlockOperation blockOperation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
158public static SyntaxNode? TryGetLastStatement(IBlockOperation? blockStatement)
Microsoft.CodeAnalysis.CSharp.Features (13)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
65IBlockOperation op => AsExpressionSyntax(op.Operations.Single()),
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
151if (blockOperation is IBlockOperation { Operations: [IThrowOperation or IExpressionStatementOperation { Operation: IThrowOperation }] })
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
78=> expressionStatementOperation.Parent is IBlockOperation blockOperation &&
src\Analyzers\CSharp\Analyzers\UseConditionalExpression\CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer.cs (1)
36if (statement is not IReturnOperation { Parent: IBlockOperation block })
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
158if (innerUsingOperation.Body is IBlockOperation innerUsingBlock)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (8)
38GetBlockOfMethodBody(methodBodyOperation) is IBlockOperation 114return GetBlockOfMethodBody(operation) is IBlockOperation 133if (GetBlockOfMethodBody(operation) is not IBlockOperation 423var body = GetBlockOfMethodBody(constructorOperation); 499var body = GetBlockOfMethodBody(operation); 1065var trueOps = ((whenTrue as IBlockOperation)?.Operations ?? [whenTrue]) 1067var falseOps = ((whenFalse as IBlockOperation)?.Operations ?? 1122private static IBlockOperation? GetBlockOfMethodBody(IMethodBodyBaseOperation body)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\TopLevelStatementsTests.cs (3)
204Assert.NotNull(ControlFlowGraph.Create((IMethodBodyOperation)((IBlockOperation)operation1.Parent.Parent).Parent)); 332Assert.NotNull(ControlFlowGraph.Create((IMethodBodyOperation)((IBlockOperation)operation1.Parent.Parent).Parent)); 370Assert.NotNull(ControlFlowGraph.Create((IMethodBodyOperation)((IBlockOperation)operation2.Parent).Parent));
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\CSharpInitializeParameterService.cs (3)
34protected override SyntaxNode? TryGetLastStatement(IBlockOperation? blockStatement) 41IBlockOperation? blockStatement, 100private static IEnumerable<(ITupleOperation targetTuple, ITupleOperation valueTuple)> TryGetAssignmentExpressions(IBlockOperation blockOperation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
158public static SyntaxNode? TryGetLastStatement(IBlockOperation? blockStatement)
Microsoft.CodeAnalysis.Features (44)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
183return op is IBlockOperation block
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (2)
87if (ifOperation is not IConditionalOperation { Parent: IBlockOperation parentBlock }) 146case IBlockOperation { Operations: { Length: 1 } statements }:
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (10)
55IBlockOperation? blockStatementOpt, 88IBlockOperation? blockStatementOpt, 126IBlockOperation? blockStatementOpt, 245IBlockOperation? blockStatementOpt, CancellationToken cancellationToken) 316IBlockOperation? blockStatement, 339IBlockOperation? blockStatementOpt, 355IBlockOperation? blockStatement, 410IBlockOperation? blockStatement, 456IBlockOperation? blockStatement, 487IBlockOperation? blockStatement,
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (17)
50Document document, SyntaxNode functionDeclaration, IMethodSymbol method, IBlockOperation? blockStatementOpt, 63IBlockOperation? blockStatement, 107IBlockOperation? blockStatement, 158IBlockOperation? blockStatement, 191IBlockOperation? blockStatement, 214IBlockOperation? blockStatement, 240IBlockOperation? blockStatement, 261IParameterSymbol parameter, IBlockOperation? blockStatement) 359IBlockOperation? blockStatement, 393IBlockOperation? currentBlockStatement = null; 396currentBlockStatement = (IBlockOperation?)currentSemanticModel.GetOperation(currentRoot.GetCurrentNode(blockStatement.Syntax)!, cancellationToken); 423IBlockOperation? blockStatement, 472IBlockOperation? blockStatement, 539IParameterSymbol parameter, IBlockOperation? blockStatement, 574IParameterSymbol parameter, IBlockOperation? blockStatement, out ISymbol? fieldOrProperty) 615Document document, IParameterSymbol parameter, IBlockOperation? blockStatement, ImmutableArray<NamingRule> rules, ImmutableArray<string> parameterWords, CancellationToken cancellationToken) 668static bool ContainsMemberAssignment(IBlockOperation? blockStatement, ISymbol member)
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (4)
40IBlockOperation? blockStatement, 51IBlockOperation? blockStatement, 141CancellationToken cancellationToken, out IBlockOperation? blockStatement) 170blockStatement = (IBlockOperation)operation;
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (2)
60if (operation is not IBlockOperation blockOperation) 77while (blockOperation.Operations is [IBlockOperation childBlock])
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (1)
49if (ifOperation.Parent is not IBlockOperation parentBlock)
src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (1)
60=> statement is IBlockOperation { Operations: [var operationInBlock] }
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (4)
104if (ifOperation.Parent is not IBlockOperation containingBlock) 139private static bool ValueIsAccessed(SemanticModel semanticModel, IConditionalOperation ifOperation, IBlockOperation containingBlock, ISymbol localOrParameter, IExpressionStatementOperation expressionStatement, IAssignmentOperation assignmentExpression) 168IBlockOperation containingBlock, IConditionalOperation ifOperation, ISymbol localOrParameter, 276if (containingOperation is IBlockOperation block)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
187if (ifOperation.Parent is not IBlockOperation parentBlock)
ValueTracking\ValueTracker.OperationCollector.cs (1)
39IBlockOperation blockOperation => VisitReturnDescendentsAsync(blockOperation, allowImplicit: false, cancellationToken),
Microsoft.CodeAnalysis.Test.Utilities (6)
Compilation\CompilationExtensions.cs (1)
365case IBlockOperation blockOperation:
Compilation\ControlFlowGraphVerifier.cs (1)
44case IBlockOperation blockOperation:
Compilation\OperationTreeVerifier.cs (2)
440public override void VisitBlock(IBlockOperation operation) 442LogString(nameof(IBlockOperation));
Compilation\TestOperationVisitor.cs (1)
117public override void VisitBlock(IBlockOperation operation)
Diagnostics\OperationTestAnalyzer.cs (1)
1315var block = lambdaExpression.Body;
Microsoft.CodeAnalysis.UnitTests (2)
Diagnostics\OperationTests.cs (2)
120Assert.Throws<ArgumentNullException>(() => ControlFlowGraph.Create((IBlockOperation)null)); 150IBlockOperation block = new BlockOperation(
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\InitializeParameter\InitializeParameterHelpers.vb (1)
44Public Shared Function TryGetLastStatement(blockStatementOpt As IBlockOperation) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\InitializeParameter\VisualBasicInitializeParameterService.vb (2)
44Protected Overrides Function TryGetLastStatement(blockStatement As IBlockOperation) As SyntaxNode 48Protected Overrides Function TryUpdateTupleAssignment(blockStatement As IBlockOperation, parameter As IParameterSymbol, fieldOrProperty As ISymbol, editor As SyntaxEditor) As Boolean
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\InitializeParameter\InitializeParameterHelpers.vb (1)
44Public Shared Function TryGetLastStatement(blockStatementOpt As IBlockOperation) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\InitializeParameter\VisualBasicInitializeParameterService.vb (2)
44Protected Overrides Function TryGetLastStatement(blockStatement As IBlockOperation) As SyntaxNode 48Protected Overrides Function TryUpdateTupleAssignment(blockStatement As IBlockOperation, parameter As IParameterSymbol, fieldOrProperty As ISymbol, editor As SyntaxEditor) As Boolean
Microsoft.CodeAnalysis.Workspaces (12)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
406if (firstBlock is not IBlockOperation block)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (7)
27protected abstract SyntaxNode? TryGetLastStatement(IBlockOperation? blockStatement); 29protected abstract bool TryUpdateTupleAssignment(IBlockOperation? blockStatement, IParameterSymbol parameter, ISymbol fieldOrProperty, SyntaxEditor editor); 41out IBlockOperation? blockStatement) 70blockStatement = (IBlockOperation)operation; 121if (TryGetBlockForSingleParameterInitialization(functionDeclaration, semanticModel, syntaxFacts, cancellationToken, out var blockStatementOpt)) 136IBlockOperation? blockStatement, 165IParameterSymbol parameter, IBlockOperation? blockStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\IInitializeParameterService.cs (1)
29out IBlockOperation? blockStatement);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (2)
76public static IOperation? TryFindFieldOrPropertyAssignmentStatement(IParameterSymbol parameter, IBlockOperation? blockStatement) 80IParameterSymbol parameter, IBlockOperation? blockStatement, out ISymbol? fieldOrProperty)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
36while (rootOperation is not IBlockOperation &&