367 references to ExpressionStatementSyntax
Microsoft.Analyzers.Extra.Tests (1)
SyntaxNodeExtensionsTests.cs (1)
90typeof(ExpressionStatementSyntax),
Microsoft.AspNetCore.App.Analyzers (4)
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (2)
253((ExpressionStatementSyntax)statement).Expression, out left, out _, out right); 260if (statement is ExpressionStatementSyntax expressionStatement)
RouteEmbeddedLanguage\Infrastructure\SyntaxNodeExtensions.cs (1)
70=> statement is ExpressionStatementSyntax exprStatement &&
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
375if (statement is ExpressionStatementSyntax expressionStatement && expressionStatement.Expression is InvocationExpressionSyntax)
Microsoft.AspNetCore.App.CodeFixes (1)
WebApplicationBuilderFixer.cs (1)
124if (statement is not ExpressionStatementSyntax currentStatement
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParameterAnalyzer.cs (1)
198assignmentExpression = (setter.Body.Statements[0] as ExpressionStatementSyntax)?.Expression as AssignmentExpressionSyntax;
Microsoft.CodeAnalysis.CSharp (18)
Binder\Binder_Deconstruct.cs (1)
195return ((ExpressionStatementSyntax)grandParent).Expression != parent;
Binder\Binder_Expressions.cs (1)
10989resultIsUsed = ((ExpressionStatementSyntax)parent).Expression != node;
Binder\Binder_Initializers.cs (1)
278Error(diagnostics, ErrorCode.ERR_SemicolonExpected, ((ExpressionStatementSyntax)labeledStatementBody.Syntax).SemicolonToken);
Binder\Binder_Statements.cs (2)
73result = BindExpressionStatement((ExpressionStatementSyntax)node, diagnostics); 642public BoundStatement BindExpressionStatement(ExpressionStatementSyntax node, BindingDiagnosticBag diagnostics)
Binder\ExpressionVariableFinder.cs (1)
193public override void VisitExpressionStatement(ExpressionStatementSyntax node)
Binder\LocalBinderFactory.cs (1)
931public override void VisitExpressionStatement(ExpressionStatementSyntax node)
Compilation\CSharpCompilation.cs (2)
794var expressionStatement = (ExpressionStatementSyntax)statement;
Lowering\InitializerRewriter.cs (1)
84return (statement.Kind == BoundKind.ExpressionStatement) && ((ExpressionStatementSyntax)statement.Syntax).SemicolonToken.IsMissing ?
Parser\LanguageParser.cs (5)
2866statement is ExpressionStatementSyntax { Expression.Kind: SyntaxKind.IdentifierName, SemicolonToken.IsMissing: true }: 8850var expressionStatementSyntax = (ExpressionStatementSyntax)statement; 10499private ExpressionStatementSyntax ParseExpressionStatement(SyntaxList<AttributeListSyntax> attributes) 10504private ExpressionStatementSyntax ParseExpressionStatement(SyntaxList<AttributeListSyntax> attributes, ExpressionSyntax expression)
Syntax\ExpressionStatementSyntax.cs (2)
28public ExpressionStatementSyntax Update(ExpressionSyntax expression, SyntaxToken semicolonToken) 37public static ExpressionStatementSyntax ExpressionStatement(ExpressionSyntax expression, SyntaxToken semicolonToken)
Syntax\LookupPosition.cs (1)
393return ((ExpressionStatementSyntax)statement).SemicolonToken;
Microsoft.CodeAnalysis.CSharp.CodeStyle (26)
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
269public override SyntaxKind VisitExpressionStatement(ExpressionStatementSyntax node)
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (4)
80if (innerStatement is not ExpressionStatementSyntax expressionStatement) 116ExpressionStatementSyntax expressionStatement, 168ExpressionStatementSyntax expressionStatement, 219ExpressionStatementSyntax expressionStatement,
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
314if (statement is ExpressionStatementSyntax expressionStatement)
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
246GetSingleStatementFromAccessor<ExpressionStatementSyntax>(setAccessor)?.Expression;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
411if (locallyScopedExpression.Parent is ExpressionStatementSyntax) 887if (currentStatement is not ExpressionStatementSyntax
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (2)
23ExpressionStatementSyntax, 98case ExpressionStatementSyntax { Expression: InvocationExpressionSyntax invocation } expressionStatement:
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
26ExpressionStatementSyntax,
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (1)
113assignment = whenTrue is ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignmentTemp }
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
354assignment.Parent is ExpressionStatementSyntax expressionStatement &&
src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (1)
29ExpressionStatementSyntax>
src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseNamedMemberInitializerAnalyzer.cs (1)
18ExpressionStatementSyntax,
src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseObjectInitializerDiagnosticAnalyzer.cs (1)
22ExpressionStatementSyntax,
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (1)
53var dummyStatement = ExpressionStatement(AssignmentExpression(
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
412if (!block.Statements.All(static s => s is ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax })) 420if (statement is not ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax assignmentExpression } ||
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (1)
139if (assignmentStatement is not ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment })
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (1)
183if (firstStatement is ExpressionStatementSyntax exprStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
1298=> statement is ExpressionStatementSyntax exprStatement && 1305((ExpressionStatementSyntax)statement).Expression, out left, out operatorToken, out right); 1312if (statement is ExpressionStatementSyntax expressionStatement) 1358=> ((ExpressionStatementSyntax)node).Expression;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (35)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (2)
93private ExpressionStatementSyntax GenerateAssignment(ExpressionSyntax switchExpression, SyntaxKind assignmentKind, SyntaxTriviaList leadingTrivia) 291public override ExpressionSyntax VisitExpressionStatement(ExpressionStatementSyntax node)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
184(expression.Parent as AssignmentExpressionSyntax)?.Parent as ExpressionStatementSyntax)
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (5)
84var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan); 131var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan); 142var newStatement = expressionStatement.WithExpression(
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
30ExpressionStatementSyntax, LocalDeclarationStatementSyntax, VariableDeclaratorSyntax,
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (6)
464if (node is ExpressionStatementSyntax expressionStatement) 507var trueStatement = (ExpressionStatementSyntax)UnwrapEmbeddedStatement(ifStatement.Statement); 522var falseStatement = (ExpressionStatementSyntax)UnwrapEmbeddedStatement(ifStatement.Else.Statement); 776if (node is ExpressionStatementSyntax expressionStatement)
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
28ExpressionStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
45var statement = (ExpressionStatementSyntax)match.Node;
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
133private ExpressionStatementSyntax CreateDeconstructionStatement(
src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
29ExpressionStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (2)
17using ObjectInitializerMatch = Match<ExpressionSyntax, StatementSyntax, MemberAccessExpressionSyntax, ExpressionStatementSyntax>; 29ExpressionStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (4)
414var expressionStatement = (ExpressionStatementSyntax)statement; 422AssignmentExpressionSyntax assignmentExpression, ExpressionStatementSyntax? expressionStatement) 442SyntaxNode UpdateDeclaration(SyntaxNode declaration, AssignmentExpressionSyntax assignmentExpression, ExpressionStatementSyntax? expressionStatement)
src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (5)
51var firstAssignmentStatement = (ExpressionStatementSyntax)diagnostic.AdditionalLocations[1].FindNode(getInnermostNodeForTie: true, cancellationToken); 52var secondAssignmentStatement = (ExpressionStatementSyntax)diagnostic.AdditionalLocations[2].FindNode(getInnermostNodeForTie: true, cancellationToken); 61var tupleAssignmentStatement = ExpressionStatement(AssignmentExpression(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (1)
25internal sealed class CSharpRefactoringHelpersService() : AbstractRefactoringHelpersService<ExpressionSyntax, ArgumentSyntax, ExpressionStatementSyntax>
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
1865if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
159ExpressionStatementSyntax _ => InferTypeInExpressionStatement(), 226ExpressionStatementSyntax _ => InferTypeInExpressionStatement(token),
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
202if (position == line.End && owningNode is ExpressionStatementSyntax)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (8)
Semantics\OutVarTests.cs (4)
5106var statement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement(@" 10207var statement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement(@"
Semantics\PatternMatchingTests_Scope.cs (4)
403var statement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement(@" 6880var statement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement(@"
Microsoft.CodeAnalysis.CSharp.Features (73)
CodeRefactorings\InlineMethod\CSharpInlineMethodRefactoringProvider.cs (1)
44ExpressionStatementSyntax expressionStatementSyntax => expressionStatementSyntax.Expression,
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
171result = IsLastTokenOfType<ExpressionStatementSyntax>(
ConvertLinq\ConvertForEachToLinqQuery\AbstractToMethodConverter.cs (2)
80if (((ExpressionStatementSyntax)previous).Expression is AssignmentExpressionSyntax assignmentExpression && 165if (((ExpressionStatementSyntax)node).Expression is AssignmentExpressionSyntax assignmentExpression)
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (2)
219var expresisonStatement = (ExpressionStatementSyntax)statementCannotBeConverted;
Debugging\CSharpProximityExpressionsService.RelevantExpressionsCollector.cs (1)
23public override void VisitExpressionStatement(ExpressionStatementSyntax node)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (1)
2818return ((ExpressionStatementSyntax)statement).Expression;
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (1)
266if (statements.ElementAtOrDefault(0) is not LocalDeclarationStatementSyntax declaration || statements.ElementAtOrDefault(1) is not ExpressionStatementSyntax assignment)
ExtractMethod\CSharpSelectionValidator.cs (1)
178firstValidNode = (firstValidNode.Parent is ExpressionStatementSyntax) ? firstValidNode.Parent : firstValidNode;
ExtractMethod\CSharpSelectionValidator.Validator.cs (1)
60ExpressionStatementSyntax or
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (7)
33ExpressionStatementSyntax, 42protected override bool IsValid(ExpressionStatementSyntax expressionStatement, TextSpan span) 58ExpressionStatementSyntax expressionStatement, LocalDeclarationStatementSyntax localDeclaration) 73protected override ExpressionStatementSyntax FixupDeconstruction( 74ExpressionStatementSyntax expressionStatement, ExpressionStatementSyntax deconstruction) 89protected override async Task<ExpressionStatementSyntax> CreateTupleDeconstructionAsync(
Snippets\CSharpConsoleSnippetProvider.cs (1)
19ExpressionStatementSyntax,
Snippets\CSharpForEachLoopSnippetProvider.cs (2)
46if (token is { RawKind: (int)SyntaxKind.AwaitKeyword, Parent: ExpressionSyntax { Parent: ExpressionStatementSyntax } } || 47token is { RawKind: (int)SyntaxKind.IdentifierToken, ValueText: "await", Parent: IdentifierNameSyntax { Parent: ExpressionStatementSyntax } })
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
269public override SyntaxKind VisitExpressionStatement(ExpressionStatementSyntax node)
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (4)
80if (innerStatement is not ExpressionStatementSyntax expressionStatement) 116ExpressionStatementSyntax expressionStatement, 168ExpressionStatementSyntax expressionStatement, 219ExpressionStatementSyntax expressionStatement,
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
314if (statement is ExpressionStatementSyntax expressionStatement)
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
246GetSingleStatementFromAccessor<ExpressionStatementSyntax>(setAccessor)?.Expression;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
411if (locallyScopedExpression.Parent is ExpressionStatementSyntax) 887if (currentStatement is not ExpressionStatementSyntax
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (2)
23ExpressionStatementSyntax, 98case ExpressionStatementSyntax { Expression: InvocationExpressionSyntax invocation } expressionStatement:
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
26ExpressionStatementSyntax,
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (1)
113assignment = whenTrue is ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignmentTemp }
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
354assignment.Parent is ExpressionStatementSyntax expressionStatement &&
src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (1)
29ExpressionStatementSyntax>
src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseNamedMemberInitializerAnalyzer.cs (1)
18ExpressionStatementSyntax,
src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseObjectInitializerDiagnosticAnalyzer.cs (1)
22ExpressionStatementSyntax,
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (1)
53var dummyStatement = ExpressionStatement(AssignmentExpression(
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
412if (!block.Statements.All(static s => s is ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax })) 420if (statement is not ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax assignmentExpression } ||
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (1)
139if (assignmentStatement is not ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment })
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (2)
93private ExpressionStatementSyntax GenerateAssignment(ExpressionSyntax switchExpression, SyntaxKind assignmentKind, SyntaxTriviaList leadingTrivia) 291public override ExpressionSyntax VisitExpressionStatement(ExpressionStatementSyntax node)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
184(expression.Parent as AssignmentExpressionSyntax)?.Parent as ExpressionStatementSyntax)
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (5)
84var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan); 131var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan); 142var newStatement = expressionStatement.WithExpression(
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
30ExpressionStatementSyntax, LocalDeclarationStatementSyntax, VariableDeclaratorSyntax,
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (6)
464if (node is ExpressionStatementSyntax expressionStatement) 507var trueStatement = (ExpressionStatementSyntax)UnwrapEmbeddedStatement(ifStatement.Statement); 522var falseStatement = (ExpressionStatementSyntax)UnwrapEmbeddedStatement(ifStatement.Else.Statement); 776if (node is ExpressionStatementSyntax expressionStatement)
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
28ExpressionStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
45var statement = (ExpressionStatementSyntax)match.Node;
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
133private ExpressionStatementSyntax CreateDeconstructionStatement(
src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
29ExpressionStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (2)
17using ObjectInitializerMatch = Match<ExpressionSyntax, StatementSyntax, MemberAccessExpressionSyntax, ExpressionStatementSyntax>; 29ExpressionStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (4)
414var expressionStatement = (ExpressionStatementSyntax)statement; 422AssignmentExpressionSyntax assignmentExpression, ExpressionStatementSyntax? expressionStatement) 442SyntaxNode UpdateDeclaration(SyntaxNode declaration, AssignmentExpressionSyntax assignmentExpression, ExpressionStatementSyntax? expressionStatement)
src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (5)
51var firstAssignmentStatement = (ExpressionStatementSyntax)diagnostic.AdditionalLocations[1].FindNode(getInnermostNodeForTie: true, cancellationToken); 52var secondAssignmentStatement = (ExpressionStatementSyntax)diagnostic.AdditionalLocations[2].FindNode(getInnermostNodeForTie: true, cancellationToken); 61var tupleAssignmentStatement = ExpressionStatement(AssignmentExpression(
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (9)
IOperation\IOperationTests_IArgument.cs (7)
295VerifyOperationTreeAndDiagnosticsForTest<ExpressionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 584VerifyOperationTreeAndDiagnosticsForTest<ExpressionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 974VerifyOperationTreeAndDiagnosticsForTest<ExpressionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3213VerifyOperationTreeAndDiagnosticsForTest<ExpressionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3250VerifyOperationTreeAndDiagnosticsForTest<ExpressionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3412VerifyOperationTreeAndDiagnosticsForTest<ExpressionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3449VerifyOperationTreeAndDiagnosticsForTest<ExpressionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_IBoundDiscardOperation.cs (1)
65VerifyOperationTreeAndDiagnosticsForTest<ExpressionStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_ITupleExpression.cs (1)
2274VerifyOperationTreeAndDiagnosticsForTest<ExpressionStatementSyntax>(source, expectedTree, expectedDiagnostics);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (16)
Semantics\ConditionalOperatorTests.cs (2)
1291var stmt = (ExpressionStatementSyntax)methodTest.Body!.Statements.First();
Semantics\DelegateTypeTests.cs (1)
12121var expr = ((ExpressionStatementSyntax)stmt).Expression;
Semantics\ImplicitObjectCreationTests.cs (4)
4184var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionStatementSyntax>().Single(); 4187var modifiedNode = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement("M(new());", options: ImplicitObjectCreationTestOptions);
Semantics\ReadOnlyStructsTests.cs (2)
1280var expressionStatement = (ExpressionStatementSyntax)statementSyntax;
Semantics\ScriptSemanticsTests.cs (3)
494Statement as ExpressionStatementSyntax). 1391var node3 = (ExpressionStatementSyntax)node2.Statement;
Semantics\SemanticErrorTests.cs (2)
3329var callStmt = (ExpressionStatementSyntax)mainMethod.Body.Statements[0];
Semantics\TopLevelStatementsTests.cs (2)
9707model.TryGetSpeculativeSemanticModel(root.DescendantNodes().Single(n => n is ExpressionStatementSyntax { Parent: GlobalStatementSyntax }).Span.End, nodeToSpeculate, out var speculativeModelInTopLevel); 9712model.TryGetSpeculativeSemanticModel(root.DescendantNodes().Single(n => n is ExpressionStatementSyntax { Parent: BlockSyntax }).Span.End, nodeToSpeculate, out var speculativeModelOutsideTopLevel);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (39)
Compilation\GetSemanticInfoTests.cs (13)
248var v1 = (mainStats[0] as ExpressionStatementSyntax).Expression; 252var v2 = (mainStats[1] as ExpressionStatementSyntax).Expression; 261var v6 = (mainStats[5] as ExpressionStatementSyntax).Expression; 298var call = (InvocationExpressionSyntax)((ExpressionStatementSyntax)main.Body.Statements[1]).Expression; 380var v1 = ((mainStats[1] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; 383var v2 = (mainStats[2] as ExpressionStatementSyntax).Expression; 386var v3 = ((mainStats[3] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; 390var v4 = ((mainStats[4] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; 483var v1 = ((mainStats[1] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; 486var v2 = ((mainStats[3] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; 489var v3 = ((mainStats[4] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; 543var v3 = (mainStats[3] as ExpressionStatementSyntax).Expression; 1138var expr = ((ExpressionStatementSyntax)stmt.Statement).Expression;
Compilation\SemanticModelAPITests.cs (4)
1797var call = (InvocationExpressionSyntax)((ExpressionStatementSyntax)statement.Statements[1]).Expression; 1804var call2 = (InvocationExpressionSyntax)((ExpressionStatementSyntax)((BlockSyntax)statement).Statements[2]).Expression; 2403var call = (InvocationExpressionSyntax)((ExpressionStatementSyntax)blockStatement.Statements[1]).Expression; 2411var call2 = (InvocationExpressionSyntax)((ExpressionStatementSyntax)((BlockSyntax)blockStatement).Statements[2]).Expression;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (9)
1713var statement = (ExpressionStatementSyntax)methodDecl.Body.Statements[0]; 2672var exprStmt = (ExpressionStatementSyntax)methodDecl.Body.Statements[0]; 2700var exprStmt = (ExpressionStatementSyntax)methodDecl.Body.Statements[0]; 2758var expr = tree.FindNodeOrTokenByKind(SyntaxKind.StringLiteralToken).Parent.FirstAncestorOrSelf<ExpressionStatementSyntax>().Expression; 3281var expressionStmt = (ExpressionStatementSyntax)methodDecl.Body.Statements[1];
Symbols\ExtensionMethodTests.cs (1)
2431var expr = ((ExpressionStatementSyntax)((GlobalStatementSyntax)tree.GetCompilationUnitRoot().Members[0]).Statement).Expression;
Symbols\MethodEqualityTests.cs (2)
215var exprStmt = (ExpressionStatementSyntax)stmt;
Symbols\Source\FileModifierTests.cs (4)
3645var info = model.GetSymbolInfo(((ExpressionStatementSyntax)body.Statements.First()).Expression); 3715var info = model.GetSymbolInfo(((ExpressionStatementSyntax)body.Statements.First()).Expression); 3779var info = speculativeModel!.GetSymbolInfo(((ExpressionStatementSyntax)newBody.Statements.First()).Expression); 3820var info = speculativeModel!.GetSymbolInfo(((ExpressionStatementSyntax)newBody.Statements.First()).Expression);
Symbols\Source\NullablePublicAPITests.cs (6)
1162var newSource = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement("_ = o;"); 1366var newExprStatement = (ExpressionStatementSyntax)newSource.Statements[1]; 3778var newStatement = (ExpressionStatementSyntax)SyntaxFactory.ParseStatement("_ = o1;");
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (107)
Diagnostics\LineSpanDirectiveTests.cs (1)
447case ExpressionStatementSyntax:
Generated\Syntax.Test.xml.Generated.cs (5)
10580private static ExpressionStatementSyntax GenerateExpressionStatement() 12350var node = GenerateExpressionStatement(); 12355var newNode = node.WithAttributeLists(node.AttributeLists).WithExpression(node.Expression).WithSemicolonToken(node.SemicolonToken); 17141var oldNode = GenerateExpressionStatement(); 17157var oldNode = GenerateExpressionStatement();
IncrementalParsing\BinaryExpression.cs (4)
210var statement = block.Statements[0] as ExpressionStatementSyntax; 219var statement = statementType.Statement as ExpressionStatementSyntax;
IncrementalParsing\CompoundAssignment.cs (4)
149var statement = block.Statements[0] as ExpressionStatementSyntax; 159var statement = statementType.Statement as ExpressionStatementSyntax;
IncrementalParsing\UnaryExpression.cs (4)
92var statement = block.Statements[0] as ExpressionStatementSyntax; 102var statement = statementType.Statement as ExpressionStatementSyntax;
Parsing\DeclarationParsingTests.cs (4)
4526var es = (ExpressionStatementSyntax)body.Statements[0]; 4582var xs = (ExpressionStatementSyntax)body.Statements[0];
Parsing\DeconstructionTests.cs (10)
1895var expression = ((ExpressionStatementSyntax)statement).Expression; 1907var expression = ((ExpressionStatementSyntax)statement).Expression; 1919var expression = ((ExpressionStatementSyntax)statement).Expression; 1931var expression = ((ExpressionStatementSyntax)statement).Expression; 1948var expression = ((ExpressionStatementSyntax)statement).Expression; 1964var expression = ((ExpressionStatementSyntax)statement).Expression; 1978var expression = ((ExpressionStatementSyntax)statement).Expression; 1992var expression = ((ExpressionStatementSyntax)statement).Expression; 2008var expression = ((ExpressionStatementSyntax)statement).Expression; 2019var expression = ((ExpressionStatementSyntax)statement).Expression;
Parsing\ParsingErrorRecoveryTests.cs (55)
3402var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3425var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3448var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3471var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3495var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3518var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3541var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3555var ie = (md.Body.Statements[0] as ExpressionStatementSyntax).Expression as InvocationExpressionSyntax; 3585var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3610var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3635var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3660var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3684var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3708var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3733var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3757var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3781var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3805var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3830var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3854var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3878var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3904var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3930var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3956var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 3982var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 4007var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 4032var es = (ExpressionStatementSyntax)ms.Body.Statements[0]; 7303var expressionStatement = (ExpressionStatementSyntax)globalStatement.Statement;
Parsing\StatementParsingTests.cs (12)
63var es = (ExpressionStatementSyntax)statement; 83var es = (ExpressionStatementSyntax)statement; 102var es = (ExpressionStatementSyntax)statement; 122var es = (ExpressionStatementSyntax)statement; 142var es = (ExpressionStatementSyntax)statement; 161var es = (ExpressionStatementSyntax)statement;
Syntax\SyntaxRewriterTests.cs (8)
554var exprStmt1 = (ExpressionStatementSyntax)ifStmt1.Statement; 571var exprStmt2 = (ExpressionStatementSyntax)ifStmt2.Statement; 602var exprStmt1 = (ExpressionStatementSyntax)ifStmt1.Statement; 617var exprStmt2 = (ExpressionStatementSyntax)ifStmt2.Statement;
Microsoft.CodeAnalysis.CSharp.Workspaces (10)
Classification\ClassificationHelpers.cs (1)
477if (token.Parent is IdentifierNameSyntax && token.Parent?.Parent is ExpressionStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (1)
183if (firstStatement is ExpressionStatementSyntax exprStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
1298=> statement is ExpressionStatementSyntax exprStatement && 1305((ExpressionStatementSyntax)statement).Expression, out left, out operatorToken, out right); 1312if (statement is ExpressionStatementSyntax expressionStatement) 1358=> ((ExpressionStatementSyntax)node).Expression;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (1)
25internal sealed class CSharpRefactoringHelpersService() : AbstractRefactoringHelpersService<ExpressionSyntax, ArgumentSyntax, ExpressionStatementSyntax>
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
1865if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
159ExpressionStatementSyntax _ => InferTypeInExpressionStatement(), 226ExpressionStatementSyntax _ => InferTypeInExpressionStatement(token),
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2)
CodeGeneration\SyntaxGeneratorTests.cs (2)
484VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.IdentifierName("x")), "x;"); 485VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("x"))), "x();");
Microsoft.Interop.JavaScript.JSImportGenerator (10)
JSExportCodeGenerator.cs (1)
221ExpressionStatementSyntax statement = ExpressionStatement(AssignmentExpression(
JSImportCodeGenerator.cs (1)
198private ExpressionStatementSyntax InvokeSyntax()
Marshaling\FuncJSGenerator.cs (2)
74private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source, JSFunctionTypeInfo info) 95private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source, JSFunctionTypeInfo info)
Marshaling\PrimitiveJSGenerator.cs (2)
72private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source) 79private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source)
Marshaling\TaskJSGenerator.cs (4)
83private ExpressionStatementSyntax ToManagedMethodVoid(string target, ArgumentSyntax source) 90private ExpressionStatementSyntax ToJSMethodVoid(string target, ArgumentSyntax source) 97private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source, TypeSyntax sourceType) 120private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source, TypeSyntax sourceType)
Microsoft.Interop.SourceGeneration (4)
GeneratedStatements.cs (2)
91private static ExpressionStatementSyntax GenerateStatementForNativeInvoke(BoundGenerators marshallers, StubIdentifierContext context, ExpressionSyntax expressionToInvoke) 125private static ExpressionStatementSyntax GenerateStatementForManagedInvoke(BoundGenerators marshallers, StubIdentifierContext context, ExpressionSyntax expressionToInvoke)
Utils\SyntaxFactoryExtensions.cs (2)
68public static ExpressionStatementSyntax MethodInvocationStatement(ExpressionSyntax objectOrClass, SimpleNameSyntax methodName, params ArgumentSyntax[] arguments) 104public static ExpressionStatementSyntax AssignmentStatement(ExpressionSyntax left, ExpressionSyntax right)
Microsoft.VisualStudio.LanguageServices.CSharp (2)
CodeModel\MethodXml\MethodXmlBuilder.cs (2)
74success = TryGenerateExpressionStatement((ExpressionStatementSyntax)statement); 134private bool TryGenerateExpressionStatement(ExpressionStatementSyntax expressionStatement)