1 write to Kind
Microsoft.CodeAnalysis (1)
Operations\ControlFlowRegion.cs (1)
74
Kind
= kind;
148 references to Kind
ILLink.RoslynAnalyzer (17)
DataFlow\ControlFlowGraphProxy.cs (17)
38
public RegionKind Kind => Region.
Kind
switch {
125
while (region != null && region.
Kind
!= ControlFlowRegionKind.Root) {
126
if (region.
Kind
is ControlFlowRegionKind.Try or ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter) {
141
while (region != null && region.
Kind
!= ControlFlowRegionKind.Root) {
142
if (region.
Kind
== ControlFlowRegionKind.Finally) {
153
if (catchOrFilterOrFinallyRegion.Region.
Kind
is not (ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter or ControlFlowRegionKind.Finally))
161
if (enclosingRegion.
Kind
== ControlFlowRegionKind.FilterAndHandler) {
163
Debug.Assert (enclosingRegion.
Kind
== ControlFlowRegionKind.TryAndCatch);
171
if (nested.
Kind
== ControlFlowRegionKind.Try)
180
if (region.
Kind
is not (ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter))
184
if (region.
Kind
is ControlFlowRegionKind.Catch && region.EnclosingRegion!.
Kind
is ControlFlowRegionKind.FilterAndHandler)
192
switch (nested.
Kind
) {
199
if (filter.
Kind
== ControlFlowRegionKind.Filter) {
217
if (catchOrFilter.
Kind
== ControlFlowRegionKind.Filter)
225
if (catchRegion.Region.
Kind
is not ControlFlowRegionKind.Catch)
228
return catchRegion.Region.EnclosingRegion!.
Kind
== ControlFlowRegionKind.FilterAndHandler;
Microsoft.CodeAnalysis (28)
Operations\ControlFlowBranch.cs (4)
88
Debug.Assert(source.
Kind
!= ControlFlowRegionKind.Root);
142
if (leavingRegions[i].
Kind
== ControlFlowRegionKind.Try && leavingRegions[i + 1].
Kind
== ControlFlowRegionKind.TryAndFinally)
150
Debug.Assert(builder.Last().
Kind
== ControlFlowRegionKind.Finally);
Operations\ControlFlowGraph.cs (1)
46
Debug.Assert(root.
Kind
== ControlFlowRegionKind.Root);
Operations\ControlFlowGraphBuilder.cs (17)
349
Debug.Assert(region.
Kind
!= ControlFlowRegionKind.Root);
352
if (region.
Kind
== ControlFlowRegionKind.Try && enclosing.
Kind
== ControlFlowRegionKind.TryAndFinally)
355
Debug.Assert(enclosing.NestedRegions[1].
Kind
== ControlFlowRegionKind.Finally);
372
Debug.Assert(@finally.
Kind
== ControlFlowRegionKind.Finally);
407
ControlFlowRegion? enclosing = fromRegion.
Kind
== ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion;
408
if (fromRegion.
Kind
== ControlFlowRegionKind.Try)
410
switch (enclosing!.
Kind
)
414
Debug.Assert(enclosing.NestedRegions[1].
Kind
== ControlFlowRegionKind.Finally);
428
throw ExceptionUtilities.UnexpectedValue(enclosing.
Kind
);
431
else if (fromRegion.
Kind
== ControlFlowRegionKind.Filter)
434
Debug.Assert(enclosing!.
Kind
== ControlFlowRegionKind.FilterAndHandler);
437
Debug.Assert(tryAndCatch.
Kind
== ControlFlowRegionKind.TryAndCatch);
461
Debug.Assert(tryAndCatch.
Kind
== ControlFlowRegionKind.TryAndCatch);
469
switch (@catch.
Kind
)
477
Debug.Assert(@catch.NestedRegions[0].
Kind
== ControlFlowRegionKind.Filter);
484
throw ExceptionUtilities.UnexpectedValue(@catch.
Kind
);
Operations\ControlFlowRegion.cs (6)
86
Debug.Assert(r.EnclosingRegion == null && r.
Kind
!= ControlFlowRegionKind.Root);
97
Debug.Assert(NestedRegions[0].
Kind
== (kind == ControlFlowRegionKind.TryAndFinally ? ControlFlowRegionKind.Try : ControlFlowRegionKind.Filter));
98
Debug.Assert(NestedRegions[1].
Kind
== (kind == ControlFlowRegionKind.TryAndFinally ? ControlFlowRegionKind.Finally : ControlFlowRegionKind.Catch));
106
Debug.Assert(NestedRegions[0].
Kind
== ControlFlowRegionKind.Try);
116
Debug.Assert(r.
Kind
== ControlFlowRegionKind.FilterAndHandler || r.
Kind
== ControlFlowRegionKind.Catch);
Microsoft.CodeAnalysis.AnalyzerUtilities (24)
src\RoslynAnalyzers\Utilities\FlowAnalysis\Extensions\BasicBlockExtensions.cs (3)
82
if (enclosingRegion.
Kind
== regionKind)
130
if (enclosingRegion.
Kind
== regionKind)
171
while (enclosingRegion.
Kind
!= regionKind)
src\RoslynAnalyzers\Utilities\FlowAnalysis\Extensions\IOperationExtensions_FlowAnalysis.cs (1)
27
switch (currentRegion.
Kind
)
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysis.cs (17)
228
if (finallyRegion?.EnclosingRegion!.
Kind
== ControlFlowRegionKind.TryAndFinally)
232
Debug.Assert(tryRegion.
Kind
== ControlFlowRegionKind.Try);
277
Debug.Assert(enclosingTryAndCatchRegion.
Kind
== ControlFlowRegionKind.TryAndCatch);
278
Debug.Assert(block.EnclosingRegion.
Kind
is ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter);
297
if (block.EnclosingRegion?.
Kind
== ControlFlowRegionKind.Try &&
298
block.EnclosingRegion.EnclosingRegion?.
Kind
== ControlFlowRegionKind.TryAndCatch &&
351
Debug.Assert(finallyRegion.
Kind
== ControlFlowRegionKind.Finally);
491
Debug.Assert(tryAndCatchRegion.
Kind
== ControlFlowRegionKind.TryAndCatch);
496
var catchRegion = tryAndCatchRegion.NestedRegions.FirstOrDefault(region => region.
Kind
is ControlFlowRegionKind.Catch or ControlFlowRegionKind.FilterAndHandler);
595
switch (block.EnclosingRegion.
Kind
)
598
if (block.EnclosingRegion!.EnclosingRegion!.
Kind
== ControlFlowRegionKind.TryAndCatch)
606
if (block.EnclosingRegion!.EnclosingRegion!.
Kind
== ControlFlowRegionKind.FilterAndHandler &&
607
block.EnclosingRegion.EnclosingRegion.EnclosingRegion?.
Kind
== ControlFlowRegionKind.TryAndCatch)
626
Debug.Assert(basicBlock.EnclosingRegion.
Kind
== ControlFlowRegionKind.Finally);
688
if (region.
Kind
== ControlFlowRegionKind.TryAndCatch)
728
Debug.Assert(finallyRegion.
Kind
== ControlFlowRegionKind.Finally);
809
hasAnyTryBlock |= block.EnclosingRegion.
Kind
== ControlFlowRegionKind.Try;
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\ThrownExceptionInfo.cs (3)
47
if (enclosingRegion.
Kind
== ControlFlowRegionKind.TryAndCatch)
49
Debug.Assert(enclosingRegion.NestedRegions[0].
Kind
== ControlFlowRegionKind.Try);
52
if (nestedRegion.
Kind
== ControlFlowRegionKind.Catch &&
Microsoft.CodeAnalysis.CodeStyle (23)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
316
switch (currentRegion.
Kind
)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
175
if (current.EnclosingRegion.
Kind
== ControlFlowRegionKind.Finally &&
257
Debug.Assert(region.
Kind
!= ControlFlowRegionKind.Root);
259
if (region.
Kind
== ControlFlowRegionKind.Try && enclosing.
Kind
== ControlFlowRegionKind.TryAndFinally)
262
Debug.Assert(enclosing.NestedRegions[1].
Kind
== ControlFlowRegionKind.Finally);
279
Debug.Assert(@finally.
Kind
== ControlFlowRegionKind.Finally);
318
var enclosing = fromRegion.
Kind
== ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion;
319
if (fromRegion.
Kind
== ControlFlowRegionKind.Try)
321
switch (enclosing.
Kind
)
325
Debug.Assert(enclosing.NestedRegions[1].
Kind
== ControlFlowRegionKind.Finally);
341
throw ExceptionUtilities.UnexpectedValue(enclosing.
Kind
);
344
else if (fromRegion.
Kind
== ControlFlowRegionKind.Filter)
347
Debug.Assert(enclosing.
Kind
== ControlFlowRegionKind.FilterAndHandler);
349
Debug.Assert(tryAndCatch.
Kind
== ControlFlowRegionKind.TryAndCatch);
373
Debug.Assert(tryAndCatch.
Kind
== ControlFlowRegionKind.TryAndCatch);
381
switch (@catch.
Kind
)
389
Debug.Assert(@catch.NestedRegions[0].
Kind
== ControlFlowRegionKind.Filter);
396
throw ExceptionUtilities.UnexpectedValue(@catch.
Kind
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (2)
169
if (basicBlock.EnclosingRegion.
Kind
== ControlFlowRegionKind.Catch &&
189
if (region.
Kind
== ControlFlowRegionKind.TryAndFinally)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
367
switch (outermostEnclosingRegionStartingBlock.
Kind
)
384
switch (currentRegion.
Kind
)
Microsoft.CodeAnalysis.Test.Utilities (33)
Compilation\ControlFlowGraphVerifier.cs (15)
151
Assert.Equal(ControlFlowRegionKind.Root, currentRegion.
Kind
);
297
Assert.True(block.EnclosingRegion.
Kind
== ControlFlowRegionKind.Filter || block.EnclosingRegion.
Kind
== ControlFlowRegionKind.Finally);
734
while (region.
Kind
!= ControlFlowRegionKind.Root)
736
if (region.
Kind
== ControlFlowRegionKind.Try && region.EnclosingRegion.
Kind
== ControlFlowRegionKind.TryAndFinally)
738
Debug.Assert(region.EnclosingRegion.NestedRegions[1].
Kind
== ControlFlowRegionKind.Finally);
1431
switch (region.
Kind
)
1453
switch (region.EnclosingRegion.
Kind
)
1463
Assert.False(true, $"Unexpected region kind {region.EnclosingRegion.
Kind
}");
1493
Assert.False(true, $"Unexpected region kind {region.
Kind
}");
1529
switch (region.
Kind
)
1542
switch (region.EnclosingRegion.
Kind
)
1549
Assert.False(true, $"Unexpected region kind {region.EnclosingRegion.
Kind
}");
1562
Assert.False(true, $"Unexpected region kind {region.
Kind
}");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
175
if (current.EnclosingRegion.
Kind
== ControlFlowRegionKind.Finally &&
257
Debug.Assert(region.
Kind
!= ControlFlowRegionKind.Root);
259
if (region.
Kind
== ControlFlowRegionKind.Try && enclosing.
Kind
== ControlFlowRegionKind.TryAndFinally)
262
Debug.Assert(enclosing.NestedRegions[1].
Kind
== ControlFlowRegionKind.Finally);
279
Debug.Assert(@finally.
Kind
== ControlFlowRegionKind.Finally);
318
var enclosing = fromRegion.
Kind
== ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion;
319
if (fromRegion.
Kind
== ControlFlowRegionKind.Try)
321
switch (enclosing.
Kind
)
325
Debug.Assert(enclosing.NestedRegions[1].
Kind
== ControlFlowRegionKind.Finally);
341
throw ExceptionUtilities.UnexpectedValue(enclosing.
Kind
);
344
else if (fromRegion.
Kind
== ControlFlowRegionKind.Filter)
347
Debug.Assert(enclosing.
Kind
== ControlFlowRegionKind.FilterAndHandler);
349
Debug.Assert(tryAndCatch.
Kind
== ControlFlowRegionKind.TryAndCatch);
373
Debug.Assert(tryAndCatch.
Kind
== ControlFlowRegionKind.TryAndCatch);
381
switch (@catch.
Kind
)
389
Debug.Assert(@catch.NestedRegions[0].
Kind
== ControlFlowRegionKind.Filter);
396
throw ExceptionUtilities.UnexpectedValue(@catch.
Kind
);
Microsoft.CodeAnalysis.Workspaces (23)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
316
switch (currentRegion.
Kind
)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
175
if (current.EnclosingRegion.
Kind
== ControlFlowRegionKind.Finally &&
257
Debug.Assert(region.
Kind
!= ControlFlowRegionKind.Root);
259
if (region.
Kind
== ControlFlowRegionKind.Try && enclosing.
Kind
== ControlFlowRegionKind.TryAndFinally)
262
Debug.Assert(enclosing.NestedRegions[1].
Kind
== ControlFlowRegionKind.Finally);
279
Debug.Assert(@finally.
Kind
== ControlFlowRegionKind.Finally);
318
var enclosing = fromRegion.
Kind
== ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion;
319
if (fromRegion.
Kind
== ControlFlowRegionKind.Try)
321
switch (enclosing.
Kind
)
325
Debug.Assert(enclosing.NestedRegions[1].
Kind
== ControlFlowRegionKind.Finally);
341
throw ExceptionUtilities.UnexpectedValue(enclosing.
Kind
);
344
else if (fromRegion.
Kind
== ControlFlowRegionKind.Filter)
347
Debug.Assert(enclosing.
Kind
== ControlFlowRegionKind.FilterAndHandler);
349
Debug.Assert(tryAndCatch.
Kind
== ControlFlowRegionKind.TryAndCatch);
373
Debug.Assert(tryAndCatch.
Kind
== ControlFlowRegionKind.TryAndCatch);
381
switch (@catch.
Kind
)
389
Debug.Assert(@catch.NestedRegions[0].
Kind
== ControlFlowRegionKind.Filter);
396
throw ExceptionUtilities.UnexpectedValue(@catch.
Kind
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (2)
169
if (basicBlock.EnclosingRegion.
Kind
== ControlFlowRegionKind.Catch &&
189
if (region.
Kind
== ControlFlowRegionKind.TryAndFinally)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
367
switch (outermostEnclosingRegionStartingBlock.
Kind
)
384
switch (currentRegion.
Kind
)