105 references to Expression
Microsoft.AspNetCore.Components.Analyzers (2)
ComponentParameterAnalyzer.cs (2)
188
return getter.ExpressionBody?.
Expression
as IdentifierNameSyntax;
203
assignmentExpression = setter.ExpressionBody?.
Expression
as AssignmentExpressionSyntax;
Microsoft.CodeAnalysis.CSharp (12)
Binder\Binder_Expressions.cs (1)
11409
resultIsUsed = (((ArrowExpressionClauseSyntax)parent).
Expression
!= node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda, Compilation);
Binder\Binder_Statements.cs (1)
3613
ExpressionSyntax expressionSyntax = expressionBody.
Expression
.CheckAndUnwrapRefExpression(diagnostics, out refKind);
Binder\ExpressionVariableFinder.cs (1)
134
VisitNodeToBind(node.
Expression
);
Binder\LocalBinderFactory.cs (1)
469
Visit(node.
Expression
, arrowBinder);
Lowering\ClosureConversion\ClosureConversion.cs (1)
1458
lambdaOrLambdaBodySyntax = (SyntaxNode?)localFunction.Body ?? localFunction.ExpressionBody?.
Expression
;
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
78
syntax.
Expression
.GetLocation(),
Syntax.xml.Main.Generated.cs (1)
2080
=> node.Update(VisitToken(node.ArrowToken), (ExpressionSyntax?)Visit(node.
Expression
) ?? throw new ArgumentNullException("expression"));
Syntax.xml.Syntax.Generated.cs (2)
13190
if (arrowToken != this.ArrowToken || expression != this.
Expression
)
13200
public ArrowExpressionClauseSyntax WithArrowToken(SyntaxToken arrowToken) => Update(arrowToken, this.
Expression
);
Syntax\LambdaUtilities.cs (3)
129
LocalFunctionStatementSyntax localFunctionStatementSyntax => (CSharpSyntaxNode?)localFunctionStatementSyntax.Body ?? localFunctionStatementSyntax.ExpressionBody!.
Expression
,
163
return arrowExpressionClause.
Expression
== node && arrowExpressionClause.Parent is LocalFunctionStatementSyntax;
487
=> (SyntaxNode?)localFunctionStatementSyntax.Body ?? localFunctionStatementSyntax.ExpressionBody?.
Expression
;
Microsoft.CodeAnalysis.CSharp.Analyzers (2)
MetaAnalyzers\Fixers\CSharpConfigureGeneratedCodeAnalysisFix.cs (1)
26
return new[] { method.ExpressionBody.
Expression
};
MetaAnalyzers\Fixers\CSharpEnableConcurrentExecutionFix.cs (1)
26
return new[] { method.ExpressionBody.
Expression
};
Microsoft.CodeAnalysis.CSharp.CodeStyle (12)
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
47
return methodSyntax.ExpressionBody.
Expression
is ThrowExpressionSyntax;
src\Analyzers\CSharp\Analyzers\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorDiagnosticAnalyzer.cs (2)
51
or (SyntaxKind.GetAccessorDeclaration) { ExpressionBody.
Expression
.RawKind: (int)SyntaxKind.FieldExpression })
64
if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { ExpressionBody.
Expression
: var innerExpressionBodyExpression } &&
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
194
accessorDeclaration.ExpressionBody?.
Expression
?? GetSingleStatementFromAccessor<ReturnStatementSyntax>(accessorDeclaration)?.Expression,
195
ArrowExpressionClauseSyntax arrowExpression => arrowExpression.
Expression
,
227
=> setAccessor?.ExpressionBody?.
Expression
??
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (3)
168
BlockSyntaxExtensions.MatchesPreference(getAccessor.ExpressionBody.
Expression
, conversionPreference))
170
arrowExpression = ArrowExpressionClause(getAccessor.ExpressionBody.
Expression
);
199
if (expressionBody!.
Expression
.IsKind(SyntaxKind.ThrowExpression))
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
397
{ ExpressionBody.
Expression
: AssignmentExpressionSyntax assignmentExpression }
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArrowExpressionClauseSyntaxExtensions.cs (1)
37
if (!arrowExpression.
Expression
.TryConvertToStatement(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
150
if (nodeParent is ArrowExpressionClauseSyntax arrowExpressionClause && arrowExpressionClause.
Expression
== node)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAboveReturnCodeFixProvider.cs (1)
53
exprOrStatement = localFunctionExpressionBody.
Expression
;
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
150
var localFunctionBodyOperation = semanticModel.GetOperation(localFunction.Body ?? (SyntaxNode)localFunction.ExpressionBody!.
Expression
, cancellationToken);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
57
AddEdits(text, arrowExpression.ArrowToken, arrowExpression.
Expression
, edits);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
449
(AssignmentExpressionSyntax)constructorDeclaration.ExpressionBody.
Expression
, expressionStatement: null).ConfigureAwait(false);
Microsoft.CodeAnalysis.CSharp.Features (46)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
77
localFunction.Body ?? (SyntaxNode)localFunction.ExpressionBody!.
Expression
);
CodeRefactorings\InlineMethod\CSharpInlineMethodRefactoringProvider.cs (1)
53
return methodDeclarationSyntax.ExpressionBody?.
Expression
;
Completion\CompletionProviders\CompletionUtilities.cs (3)
192
return methodDeclaration.ExpressionBody.
Expression
.Span;
224
if (firstAccessor.ExpressionBody is {
Expression
: { } expression })
227
else if (propertyDeclaration is PropertyDeclarationSyntax { ExpressionBody.
Expression
: { } expression })
EditAndContinue\BreakpointSpans.cs (8)
179
return (methodDeclaration.Body != null) ? CreateSpanForBlock(methodDeclaration.Body, position) : methodDeclaration.ExpressionBody?.
Expression
.Span;
324
return CreateSpan(accessor.ExpressionBody.
Expression
);
343
return property.ExpressionBody.
Expression
.Span;
364
return indexer.ExpressionBody.
Expression
.Span;
423
: TryCreateSpanForNode(localFunction.ExpressionBody!.
Expression
, position);
445
return constructorSyntax.ExpressionBody.
Expression
.Span;
458
return constructorSyntax.ExpressionBody.
Expression
.Span;
952
Debug.Assert(((ArrowExpressionClauseSyntax)parent).
Expression
== expression);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (2)
485
yield return localFunc.ExpressionBody.
Expression
;
586
span = ((ArrowExpressionClauseSyntax)node).
Expression
.Span;
EditAndContinue\DeclarationBody\OrdinaryInstanceConstructorDeclarationBody.cs (1)
18
=> (SyntaxNode?)constructor.Body ?? constructor.ExpressionBody?.
Expression
!;
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorWithExplicitBodyDeclarationBody.cs (1)
28
=> (SyntaxNode?)accessor.Body ?? accessor.ExpressionBody!.
Expression
;
EditAndContinue\DeclarationBody\PropertyOrIndexerWithExplicitBodyDeclarationBody.cs (1)
23
=> Body.
Expression
;
EditAndContinue\SyntaxComparer.cs (2)
774
case BaseMethodDeclarationSyntax baseMethodDeclarationSyntax: return baseMethodDeclarationSyntax.Body ?? (SyntaxNode?)baseMethodDeclarationSyntax.ExpressionBody?.
Expression
;
775
case AccessorDeclarationSyntax accessorDeclarationSyntax: return accessorDeclarationSyntax.Body ?? (SyntaxNode?)accessorDeclarationSyntax.ExpressionBody?.
Expression
;
EditAndContinue\SyntaxUtilities.cs (3)
87
=> (SyntaxNode?)blockBody ?? expressionBody?.
Expression
;
158
return propertyBody.
Expression
;
167
return (SyntaxNode?)firstGetter.Body ?? firstGetter.ExpressionBody?.
Expression
;
ExtractMethod\CSharpSelectionValidator.cs (2)
263
var expressionBodiedMemberBody = TextSpan.FromBounds(expressionBodiedMember.
Expression
.SpanStart, expressionBodiedMember.
Expression
.Span.End);
GenerateConstructors\CSharpGenerateConstructorsCodeRefactoringProvider.cs (1)
91
return GetAccessedMemberName(arrowExpression.
Expression
);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
246
var newExpression = Rewrite(document, expression, newLocalName, document, oldBody.
Expression
, allOccurrences, cancellationToken);
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (1)
263
semanticModel, setMethod.Parameters[0], oldExpressionBody.
Expression
);
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
47
return methodSyntax.ExpressionBody.
Expression
is ThrowExpressionSyntax;
src\Analyzers\CSharp\Analyzers\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorDiagnosticAnalyzer.cs (2)
51
or (SyntaxKind.GetAccessorDeclaration) { ExpressionBody.
Expression
.RawKind: (int)SyntaxKind.FieldExpression })
64
if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { ExpressionBody.
Expression
: var innerExpressionBodyExpression } &&
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
194
accessorDeclaration.ExpressionBody?.
Expression
?? GetSingleStatementFromAccessor<ReturnStatementSyntax>(accessorDeclaration)?.Expression,
195
ArrowExpressionClauseSyntax arrowExpression => arrowExpression.
Expression
,
227
=> setAccessor?.ExpressionBody?.
Expression
??
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (3)
168
BlockSyntaxExtensions.MatchesPreference(getAccessor.ExpressionBody.
Expression
, conversionPreference))
170
arrowExpression = ArrowExpressionClause(getAccessor.ExpressionBody.
Expression
);
199
if (expressionBody!.
Expression
.IsKind(SyntaxKind.ThrowExpression))
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
397
{ ExpressionBody.
Expression
: AssignmentExpressionSyntax assignmentExpression }
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAboveReturnCodeFixProvider.cs (1)
53
exprOrStatement = localFunctionExpressionBody.
Expression
;
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
150
var localFunctionBodyOperation = semanticModel.GetOperation(localFunction.Body ?? (SyntaxNode)localFunction.ExpressionBody!.
Expression
, cancellationToken);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
57
AddEdits(text, arrowExpression.ArrowToken, arrowExpression.
Expression
, edits);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
449
(AssignmentExpressionSyntax)constructorDeclaration.ExpressionBody.
Expression
, expressionStatement: null).ConfigureAwait(false);
src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (3)
129
LocalFunctionStatementSyntax localFunctionStatementSyntax => (CSharpSyntaxNode?)localFunctionStatementSyntax.Body ?? localFunctionStatementSyntax.ExpressionBody!.
Expression
,
163
return arrowExpressionClause.
Expression
== node && arrowExpressionClause.Parent is LocalFunctionStatementSyntax;
487
=> (SyntaxNode?)localFunctionStatementSyntax.Body ?? localFunctionStatementSyntax.ExpressionBody?.
Expression
;
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (1)
263
return arrowExpression.
Expression
;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (6)
Semantics\ExpressionBodiedMemberTests.cs (6)
475
var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().
Expression
;
506
var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().
Expression
;
535
var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().
Expression
;
575
var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().
Expression
;
649
var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().
Expression
;
680
var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().
Expression
;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Compilation\SemanticModelAPITests.cs (1)
1680
var expr = newExpressionBody.
Expression
;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (5)
Generated\Syntax.Test.xml.Generated.cs (2)
13550
Assert.NotNull(node.
Expression
);
13551
var newNode = node.WithArrowToken(node.ArrowToken).WithExpression(node.
Expression
);
Parsing\DeclarationParsingTests.cs (1)
2916
Assert.NotNull(propertySyntax.ExpressionBody.
Expression
);
Parsing\LocalFunctionParsingTests.cs (1)
1356
Assert.Equal(SyntaxKind.NumericLiteralExpression, s1.ExpressionBody.
Expression
.Kind());
Syntax\FieldAndValueKeywordTests.cs (1)
1567
var expr = syntaxTree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().
Expression
;
Microsoft.CodeAnalysis.CSharp.Workspaces (11)
CodeGeneration\CSharpSyntaxGenerator.cs (8)
2437
return pd.ExpressionBody.
Expression
;
2446
return id.ExpressionBody.
Expression
;
2455
return method.ExpressionBody.
Expression
;
2464
return local.ExpressionBody.
Expression
;
2493
return ReplaceWithTrivia(pd, pd.ExpressionBody.
Expression
, expr);
2502
return ReplaceWithTrivia(id, id.ExpressionBody.
Expression
, expr);
2511
return ReplaceWithTrivia(method, method.ExpressionBody.
Expression
, expr);
2520
return ReplaceWithTrivia(local, local.ExpressionBody.
Expression
, expr);
Rename\CSharpRenameRewriterLanguageService.cs (1)
1134
return possibleArrowExpressionClause.
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArrowExpressionClauseSyntaxExtensions.cs (1)
37
if (!arrowExpression.
Expression
.TryConvertToStatement(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
150
if (nodeParent is ArrowExpressionClauseSyntax arrowExpressionClause && arrowExpressionClause.
Expression
== node)
Microsoft.VisualStudio.LanguageServices.CSharp (1)
CodeModel\CSharpCodeModelService.NodeLocator.cs (1)
232
startPosition = node.
Expression
.SpanStart;
Roslyn.Diagnostics.CSharp.Analyzers (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArrowExpressionClauseSyntaxExtensions.cs (1)
37
if (!arrowExpression.
Expression
.TryConvertToStatement(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
150
if (nodeParent is ArrowExpressionClauseSyntax arrowExpressionClause && arrowExpressionClause.
Expression
== node)
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
302
return DecomposeConditionForIsSupportedGroups(context, model, arrowExpression.
Expression
);