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