87 references to Catches
Microsoft.CodeAnalysis.CSharp (12)
Binder\Binder_Statements.cs (2)
3242
var catchBlocks = BindCatchBlocks(node.
Catches
, diagnostics);
3399
: (filter.Parent.Parent is TryStatementSyntax s && s.
Catches
.Count == 1 && s.Finally == null)
Binder\LocalBinderFactory.cs (2)
853
if (node.
Catches
.Any())
866
foreach (CatchClauseSyntax c in node.
Catches
)
Syntax.xml.Main.Generated.cs (1)
1942
=> node.Update(VisitList(node.AttributeLists), VisitToken(node.TryKeyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block"), VisitList(node.
Catches
), (FinallyClauseSyntax?)Visit(node.Finally));
Syntax.xml.Syntax.Generated.cs (6)
9001
if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.
Catches
|| @finally != this.Finally)
9012
public new TryStatementSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.TryKeyword, this.Block, this.
Catches
, this.Finally);
9013
public TryStatementSyntax WithTryKeyword(SyntaxToken tryKeyword) => Update(this.AttributeLists, tryKeyword, this.Block, this.
Catches
, this.Finally);
9014
public TryStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.TryKeyword, block, this.
Catches
, this.Finally);
9016
public TryStatementSyntax WithFinally(FinallyClauseSyntax? @finally) => Update(this.AttributeLists, this.TryKeyword, this.Block, this.
Catches
, @finally);
9022
public TryStatementSyntax AddCatches(params CatchClauseSyntax[] items) => WithCatches(this.
Catches
.AddRange(items));
Syntax\LookupPosition.cs (1)
426
CatchClauseSyntax? lastCatch = tryStmt.
Catches
.LastOrDefault();
Microsoft.CodeAnalysis.CSharp.Features (9)
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
287
foreach (var catchClause in tryStatement.
Catches
)
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (1)
187
foreach (var catchClause in tryStatement.
Catches
)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (4)
2663
&& SyntaxFactory.AreEquivalent(oldTryStatement.
Catches
, newTryStatement.
Catches
);
2697
if (tryStatement.
Catches
is not [var firstCatch, ..])
2707
: tryStatement.
Catches
.Last().Span.End);
Highlighting\KeywordHighlighters\TryStatementHighlighter.cs (1)
32
foreach (var catchDeclaration in tryStatement.
Catches
)
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (1)
36
=> tryStatement.
Catches
.Count > 0;
Structure\Providers\BlockSyntaxStructureProvider.cs (1)
74
foreach (var catchClause in tryStatement.
Catches
)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (66)
Generated\Syntax.Test.xml.Generated.cs (2)
12890
Assert.Equal(default, node.
Catches
);
12892
var newNode = node.WithAttributeLists(node.AttributeLists).WithTryKeyword(node.TryKeyword).WithBlock(node.Block).WithCatches(node.
Catches
).WithFinally(node.Finally);
Parsing\StatementParsingTests.cs (64)
1238
Assert.Equal(1, ts.
Catches
.Count);
1239
Assert.NotEqual(default, ts.
Catches
[0].CatchKeyword);
1240
Assert.NotNull(ts.
Catches
[0].Declaration);
1241
Assert.NotEqual(default, ts.
Catches
[0].Declaration.OpenParenToken);
1242
Assert.NotNull(ts.
Catches
[0].Declaration.Type);
1243
Assert.Equal("T", ts.
Catches
[0].Declaration.Type.ToString());
1244
Assert.NotEqual(default, ts.
Catches
[0].Declaration.Identifier);
1245
Assert.Equal("e", ts.
Catches
[0].Declaration.Identifier.ToString());
1246
Assert.NotEqual(default, ts.
Catches
[0].Declaration.CloseParenToken);
1247
Assert.NotNull(ts.
Catches
[0].Block);
1268
Assert.Equal(1, ts.
Catches
.Count);
1269
Assert.NotEqual(default, ts.
Catches
[0].CatchKeyword);
1270
Assert.NotNull(ts.
Catches
[0].Declaration);
1271
Assert.NotEqual(default, ts.
Catches
[0].Declaration.OpenParenToken);
1272
Assert.NotNull(ts.
Catches
[0].Declaration.Type);
1273
Assert.Equal("T", ts.
Catches
[0].Declaration.Type.ToString());
1274
Assert.Equal(SyntaxKind.None, ts.
Catches
[0].Declaration.Identifier.Kind());
1275
Assert.NotEqual(default, ts.
Catches
[0].Declaration.CloseParenToken);
1276
Assert.NotNull(ts.
Catches
[0].Block);
1297
Assert.Equal(1, ts.
Catches
.Count);
1298
Assert.NotEqual(default, ts.
Catches
[0].CatchKeyword);
1299
Assert.Null(ts.
Catches
[0].Declaration);
1300
Assert.NotNull(ts.
Catches
[0].Block);
1321
Assert.Equal(3, ts.
Catches
.Count);
1323
Assert.NotEqual(default, ts.
Catches
[0].CatchKeyword);
1324
Assert.NotNull(ts.
Catches
[0].Declaration);
1325
Assert.NotEqual(default, ts.
Catches
[0].Declaration.OpenParenToken);
1326
Assert.NotNull(ts.
Catches
[0].Declaration.Type);
1327
Assert.Equal("T", ts.
Catches
[0].Declaration.Type.ToString());
1328
Assert.NotEqual(default, ts.
Catches
[0].Declaration.Identifier);
1329
Assert.Equal("e", ts.
Catches
[0].Declaration.Identifier.ToString());
1330
Assert.NotEqual(default, ts.
Catches
[0].Declaration.CloseParenToken);
1331
Assert.NotNull(ts.
Catches
[0].Block);
1333
Assert.NotEqual(default, ts.
Catches
[1].CatchKeyword);
1334
Assert.NotNull(ts.
Catches
[1].Declaration);
1335
Assert.NotEqual(default, ts.
Catches
[1].Declaration.OpenParenToken);
1336
Assert.NotNull(ts.
Catches
[1].Declaration.Type);
1337
Assert.Equal("T2", ts.
Catches
[1].Declaration.Type.ToString());
1338
Assert.NotEqual(default, ts.
Catches
[1].Declaration.CloseParenToken);
1339
Assert.NotNull(ts.
Catches
[1].Block);
1341
Assert.NotEqual(default, ts.
Catches
[2].CatchKeyword);
1342
Assert.Null(ts.
Catches
[2].Declaration);
1343
Assert.NotNull(ts.
Catches
[2].Block);
1364
Assert.Equal(0, ts.
Catches
.Count);
1387
Assert.Equal(3, ts.
Catches
.Count);
1389
Assert.NotEqual(default, ts.
Catches
[0].CatchKeyword);
1390
Assert.NotNull(ts.
Catches
[0].Declaration);
1391
Assert.NotEqual(default, ts.
Catches
[0].Declaration.OpenParenToken);
1392
Assert.NotNull(ts.
Catches
[0].Declaration.Type);
1393
Assert.Equal("T", ts.
Catches
[0].Declaration.Type.ToString());
1394
Assert.NotEqual(default, ts.
Catches
[0].Declaration.Identifier);
1395
Assert.Equal("e", ts.
Catches
[0].Declaration.Identifier.ToString());
1396
Assert.NotEqual(default, ts.
Catches
[0].Declaration.CloseParenToken);
1397
Assert.NotNull(ts.
Catches
[0].Block);
1399
Assert.NotEqual(default, ts.
Catches
[1].CatchKeyword);
1400
Assert.NotNull(ts.
Catches
[1].Declaration);
1401
Assert.NotEqual(default, ts.
Catches
[1].Declaration.OpenParenToken);
1402
Assert.NotNull(ts.
Catches
[1].Declaration.Type);
1403
Assert.Equal("T2", ts.
Catches
[1].Declaration.Type.ToString());
1404
Assert.NotEqual(default, ts.
Catches
[1].Declaration.CloseParenToken);
1405
Assert.NotNull(ts.
Catches
[1].Block);
1407
Assert.NotEqual(default, ts.
Catches
[2].CatchKeyword);
1408
Assert.Null(ts.
Catches
[2].Declaration);
1409
Assert.NotNull(ts.
Catches
[2].Block);