232 references to Expression
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.cs (1)
136routePatternArgumentSyntax.Expression is not LiteralExpressionSyntax routePatternArgumentLiteralSyntax)
Microsoft.AspNetCore.App.Analyzers (6)
Kestrel\ListenOnIPv6AnyAnalyzer.cs (1)
63Expression: MemberAccessExpressionSyntax
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
417if (argument.Expression is DeclarationExpressionSyntax declarationExpression &&
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (2)
300if (routeStringArgument?.Expression is not LiteralExpressionSyntax literalExpression) 305return new MapMethodParts(method, literalExpression, delegateArgument.Expression);
RouteHandlers\RouteHandlerAnalyzer.cs (1)
185routePatternArgumentSyntax.Expression is not LiteralExpressionSyntax routePatternArgumentLiteralSyntax)
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
369var lambdaExpression = arguments?.Expression as SimpleLambdaExpressionSyntax;
Microsoft.AspNetCore.App.CodeFixes (4)
Authorization\AddAuthorizationBuilderFixer.cs (1)
62&& arguments[0].Expression is SimpleLambdaExpressionSyntax lambda)
Http\HeaderDictionaryAddFixer.cs (1)
130arguments[1].Expression);
Http\HeaderDictionaryIndexerFixer.cs (1)
54param = argumentSyntax.Expression;
WebApplicationBuilderFixer.cs (1)
114|| initArgument.Expression is not LambdaExpressionSyntax lambdaExpr)
Microsoft.AspNetCore.OpenApi.SourceGenerators (2)
XmlCommentGenerator.Parser.cs (2)
172if (argument.Expression is LiteralExpressionSyntax) 176else if (argument.Expression is LambdaExpressionSyntax)
Microsoft.CodeAnalysis.CSharp (22)
_generated\0\Syntax.xml.Main.Generated.cs (1)
1662=> node.Update((NameColonSyntax?)Visit(node.NameColon), VisitToken(node.RefKindKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"));
_generated\2\Syntax.xml.Syntax.Generated.cs (3)
2779if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) 2789public ArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(nameColon, this.RefKindKeyword, this.Expression); 2790public ArgumentSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(this.NameColon, refKindKeyword, this.Expression);
Binder\Binder_Deconstruct.cs (1)
787builder.Add(BindDeconstructionVariables(arg.Expression, diagnostics, ref declaration, ref expression));
Binder\Binder_Expressions.cs (8)
1045ImmutableArray.Create(BindValue(arguments[0].Expression, diagnostics, BindValueKind.RValue)) : 1075BoundExpression boundArgument = BindValue(argumentSyntax.Expression, diagnostics, BindValueKind.RValue); 1145inferredName = InferTupleElementName(argumentSyntax.Expression); 3142switch (argumentSyntax.Expression.Kind()) 3204argumentSyntax.Expression.CheckDeconstructionCompatibleArgument(diagnostics); 3213if (argumentSyntax.Expression.Kind() == SyntaxKind.DeclarationExpression) 3218var declarationExpression = (DeclarationExpressionSyntax)argumentSyntax.Expression; 3225return BindArgumentExpression(diagnostics, argumentSyntax.Expression, refKind, allowArglist);
Binder\Binder_Invocation.cs (2)
2365if (binder.EnclosingNameofArgument == node.ArgumentList.Arguments[0].Expression) 2379var argument = node.ArgumentList.Arguments[0].Expression;
Binder\ExpressionVariableFinder.cs (2)
90Visit(arg.Expression); 477CollectVariablesFromDeconstruction(arg.Expression, deconstruction);
Binder\ForEachLoopBinder.cs (1)
115CollectLocalsFromDeconstruction(arg.Expression, kind, locals, deconstructionStatement, enclosingBinderOpt);
Binder\LocalBinderFactory.cs (1)
233var argumentExpression = node.ArgumentList.Arguments[0].Expression;
Symbols\Source\SourceFixedFieldSymbol.cs (2)
73if (arguments.Count == 0 || arguments[0].Expression.Kind() == SyntaxKind.OmittedArraySizeExpression) 84ExpressionSyntax sizeExpression = arguments[0].Expression;
Syntax\ArgumentSyntax.cs (1)
26return this.Update(this.NameColon, refOrOutKeyword, this.Expression);
Microsoft.CodeAnalysis.CSharp.Analyzers (3)
MetaAnalyzers\CSharpRegisterActionAnalyzer.cs (2)
60return invocation.ArgumentList.Arguments.Select(a => a.Expression); 68return argument.Expression;
MetaAnalyzers\CSharpReportDiagnosticAnalyzer.cs (1)
33return invocation.ArgumentList.Arguments.Select(a => a.Expression);
Microsoft.CodeAnalysis.CSharp.CodeStyle (31)
src\roslyn\src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
88var argumentExpression = argumentNode.Expression;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
102if (argument.Expression is not IdentifierNameSyntax argumentIdentifier)
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
110ArgumentList.Arguments: [{ Expression: LambdaExpressionSyntax whereLambda1 }], 150Expression: LambdaExpressionSyntax
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
60AddIneligibleFieldsForExpression(argument.Expression); 64if (argument.Expression.IsNameOfArgumentExpression()) 65AddIneligibleFieldsForExpression(argument.Expression, alwaysRestricted: true);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
149argumentIndex == arguments.Count - 1 && arguments[argumentIndex] is { RefKindKeyword.RawKind: (int)SyntaxKind.OutKeyword, Expression: DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax singleVariable } }
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
238var argumentType = semanticModel.GetTypeInfo(objectCreation.ArgumentList.Arguments[0].Expression, cancellationToken).Type;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (7)
539if (argument.Expression.IsNameOfArgumentExpression()) 581siblingArgument.Expression is DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax designation }) 836if (semanticModel.GetConstantValue(elementArgument.Expression, cancellationToken).Value is not int indexValue || 976if (arguments is [{ Expression: ArrayCreationExpressionSyntax { Initializer: not null } or ImplicitArrayCreationExpressionSyntax }]) 1004if (arguments[0].Expression 1025var argExpression = argument.Expression; 1207var expression = arguments.Single().Expression;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (3)
146preMatches.Add(new(argumentList.Arguments[0].Expression, UseSpread: true, UseKeyValue: false)); 176spreadElements.Add(invocation.ArgumentList.Arguments[0].Expression); 194var currentArgumentExpression = argumentList.Arguments[0].Expression;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
195var arg0 = invocation.ArgumentList.Arguments[0].Expression; 196var arg1 = invocation.ArgumentList.Arguments[1].Expression;
src\roslyn\src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (1)
37=> ((ArgumentSyntax)syntaxNode).Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
56stylePreferences, argument.Expression, semanticModel, tupleElementType, cancellationToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
198argument.Expression == expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (4)
88if (nodeParent.GetRequiredParent().ChildNodes().OfType<ArgumentSyntax>().Any(a => a.Expression.IsKind(opposite))) 200if (nodeParent is ArgumentSyntax argument && argument.Expression == node) 667previousExpression = argumentList.Arguments[argumentIndex - 1].Expression; 702nextExpression = argumentList.Arguments[argumentIndex + 1].Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
590=> ((ArgumentSyntax)node).Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (2)
29var inferredName = node.Expression.TryGetInferredMemberName(); 72if (argument.NameColon is null && argument.Expression.TryGetInferredMemberName()?.Equals(name) == true)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (19)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddExplicitCast\ArgumentFixer.cs (2)
18=> argument.Expression; 21=> oldArgument.WithExpression(oldArgument.Expression.Cast(conversionType));
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
166var argumentExpression = tuple.Arguments[i].Expression;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
899return arguments.SelectAsArray(a => indent(a.Expression));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForCreateCodeFixProvider.cs (1)
65var expressions = dummyObjectCreation.ArgumentList.Arguments.Select(a => a.Expression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (2)
117if (match.UseSpread && argument.Expression is CollectionExpressionSyntax collectionExpression) 133result.Add(new(argument.Expression, match.UseSpread, UseKeyValue: false));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForNewCodeFixProvider.cs (1)
66var expressions = dummyObjectCreation.ArgumentList.Arguments.Select(a => a.Expression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
126var expression = arguments[0].Expression; 137arguments.Select(a => a.Expression),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
134a => a.Expression.Kind() != SyntaxKind.DefaultLiteralExpression && Equals(arrayElementType, semanticModel.GetTypeInfo(a.Expression).Type)); 164.Select(a => a.IsNode ? ((ArgumentSyntax)a.AsNode()!).Expression : a);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
107if (existingArgument.Expression is InvocationExpressionSyntax { ArgumentList.Arguments: [{ Expression: var nameofArgument }] } invocation &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (1)
18return DetermineParameterType(argument.Expression, semanticModel, cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (1)
108argument.Expression, capitalize: false, cancellationToken: cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1835var argumentExpression = invocation.ArgumentList.Arguments[0].Expression; 2383var expr = arg.Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
31=> new(argument.GetRefKind(), argument.NameColon?.Name.Identifier.ValueText, argument.Expression);
Microsoft.CodeAnalysis.CSharp.Features (54)
ChangeSignature\CSharpChangeSignatureService.cs (2)
654lastArgumentExpression = lastArgument.Expression; 923var listOfArguments = SeparatedList(newArguments.Skip(indexInExistingList).Select(a => ((ArgumentSyntax)(SyntaxNode)a).Expression), newArguments.GetSeparators().Skip(indexInExistingList));
ChangeSignature\UnifiedArgumentSyntax.cs (1)
66? argument.Expression
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
245tupleExpression.Arguments.Count(a => nonConflictReferences.Contains(a.Expression)) == 1)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (3)
702switch (argumentSyntax.Expression?.Kind()) 707return ((DeclarationExpressionSyntax)argumentSyntax.Expression).Type; 712return argumentSyntax.Expression;
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
258var selectExpression = invocationExpression.ArgumentList.Arguments.Single().Expression;
Debugging\CSharpProximityExpressionsService.RelevantExpressionsCollector.cs (1)
119AddVariableExpressions(a.Expression, expressions);
Debugging\CSharpProximityExpressionsService_ExpressionTermCollector.cs (2)
396AddSubExpressionTerms(arg.Expression, terms, ref flags); 399terms.Add(ConvertToString(arg.Expression));
EditAndContinue\SyntaxComparer.cs (1)
1341GetLocalNames(argument.Expression, ref result);
GenerateType\CSharpGenerateTypeService.cs (1)
370objectCreationExpressionOpt.ArgumentList.Arguments is [{ Expression: (kind: not SyntaxKind.DeclarationExpression) expression }])
InlineHints\CSharpInlineParameterNameHintsService.cs (1)
82buffer.Add((argument.Span.Start, argument, parameter, GetKind(argument.Expression)));
IntroduceVariable\CSharpIntroduceVariableService.Rewriter.cs (2)
64newNode.Expression.HasAnnotation(s_replacementAnnotation) && 67var inferredName = node.Expression.TryGetInferredMemberName();
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (2)
322invocation.ArgumentList.Arguments[0].Expression.Kind() == SyntaxKind.DeclarationExpression) 341var argumentExpression = currentInvocation.ArgumentList.Arguments[0].Expression.Parenthesize();
src\roslyn\src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
88var argumentExpression = argumentNode.Expression;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
102if (argument.Expression is not IdentifierNameSyntax argumentIdentifier)
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
110ArgumentList.Arguments: [{ Expression: LambdaExpressionSyntax whereLambda1 }], 150Expression: LambdaExpressionSyntax
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
60AddIneligibleFieldsForExpression(argument.Expression); 64if (argument.Expression.IsNameOfArgumentExpression()) 65AddIneligibleFieldsForExpression(argument.Expression, alwaysRestricted: true);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
149argumentIndex == arguments.Count - 1 && arguments[argumentIndex] is { RefKindKeyword.RawKind: (int)SyntaxKind.OutKeyword, Expression: DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax singleVariable } }
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
238var argumentType = semanticModel.GetTypeInfo(objectCreation.ArgumentList.Arguments[0].Expression, cancellationToken).Type;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (7)
539if (argument.Expression.IsNameOfArgumentExpression()) 581siblingArgument.Expression is DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax designation }) 836if (semanticModel.GetConstantValue(elementArgument.Expression, cancellationToken).Value is not int indexValue || 976if (arguments is [{ Expression: ArrayCreationExpressionSyntax { Initializer: not null } or ImplicitArrayCreationExpressionSyntax }]) 1004if (arguments[0].Expression 1025var argExpression = argument.Expression; 1207var expression = arguments.Single().Expression;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (3)
146preMatches.Add(new(argumentList.Arguments[0].Expression, UseSpread: true, UseKeyValue: false)); 176spreadElements.Add(invocation.ArgumentList.Arguments[0].Expression); 194var currentArgumentExpression = argumentList.Arguments[0].Expression;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
195var arg0 = invocation.ArgumentList.Arguments[0].Expression; 196var arg1 = invocation.ArgumentList.Arguments[1].Expression;
src\roslyn\src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (1)
37=> ((ArgumentSyntax)syntaxNode).Expression;
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddExplicitCast\ArgumentFixer.cs (2)
18=> argument.Expression; 21=> oldArgument.WithExpression(oldArgument.Expression.Cast(conversionType));
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
166var argumentExpression = tuple.Arguments[i].Expression;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
899return arguments.SelectAsArray(a => indent(a.Expression));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForCreateCodeFixProvider.cs (1)
65var expressions = dummyObjectCreation.ArgumentList.Arguments.Select(a => a.Expression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (2)
117if (match.UseSpread && argument.Expression is CollectionExpressionSyntax collectionExpression) 133result.Add(new(argument.Expression, match.UseSpread, UseKeyValue: false));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForNewCodeFixProvider.cs (1)
66var expressions = dummyObjectCreation.ArgumentList.Arguments.Select(a => a.Expression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
126var expression = arguments[0].Expression; 137arguments.Select(a => a.Expression),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
134a => a.Expression.Kind() != SyntaxKind.DefaultLiteralExpression && Equals(arrayElementType, semanticModel.GetTypeInfo(a.Expression).Type)); 164.Select(a => a.IsNode ? ((ArgumentSyntax)a.AsNode()!).Expression : a);
UseNamedArguments\CSharpUseNamedArgumentsCodeRefactoringProvider.cs (1)
77=> argumentSyntax.Expression;
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (26)
Microsoft.CodeQuality.Analyzers\Maintainability\CSharpUseCrossPlatformIntrinsicsFixer.cs (3)
48if (binaryOpFunc(arguments[0].Expression, arguments[1].Expression) is not ExpressionSyntax replacementExpression) 72if (unaryOpFunc(arguments[0].Expression) is not ExpressionSyntax replacementExpression)
Microsoft.NetCore.Analyzers\Performance\CSharpCollapseMultiplePathOperations.Fixer.cs (1)
77if (argument.Expression is InvocationExpressionSyntax nestedInvocation &&
Microsoft.NetCore.Analyzers\Performance\CSharpDoNotUseCountWhenAnyCanBeUsed.Fixer.cs (1)
59sourceExpression: invocation.ArgumentList.Arguments[0].Expression,
Microsoft.NetCore.Analyzers\Performance\CSharpPreferDictionaryTryMethodsOverContainsKeyGuardFixer.cs (1)
88changedValueNode = invocation.ArgumentList.Arguments[1].Expression;
Microsoft.NetCore.Analyzers\Performance\CSharpPreferHashDataOverComputeHash.Fixer.cs (1)
83firstArg.Expression,
Microsoft.NetCore.Analyzers\Performance\CSharpPreferIsEmptyOverCount.Fixer.cs (1)
41countNode = invocationExpression.ArgumentList.Arguments[0].Expression;
Microsoft.NetCore.Analyzers\Performance\CSharpPreferLengthCountIsEmptyOverAny.Fixer.cs (2)
27expression = invocation.ArgumentList.Arguments[0].Expression; 69expression = invocation.ArgumentList.Arguments[0].Expression;
Microsoft.NetCore.Analyzers\Performance\CSharpRecommendCaseInsensitiveStringComparisonFixer.cs (1)
77desiredExpression = argumentExpression.Expression;
Microsoft.NetCore.Analyzers\Performance\CSharpUseAsSpanInsteadOfRangeIndexer.Fixer.cs (1)
29node = arg.Expression;
Microsoft.NetCore.Analyzers\Performance\CSharpUseStartsWithInsteadOfIndexOfComparisonWithZero.Fixer.cs (1)
29SyntaxFactory.InitializerExpression(SyntaxKind.ArrayInitializerExpression, SyntaxFactory.SingletonSeparatedList(argumentSyntax.Expression))
Microsoft.NetCore.Analyzers\Performance\CSharpUseStringContainsCharOverloadWithSingleCharactersFixer.cs (1)
39&& argumentSyntax.Expression is LiteralExpressionSyntax containedLiteralExpressionSyntax)
Microsoft.NetCore.Analyzers\Performance\CSharpUseStringMethodCharOverloadWithSingleCharacters.Fixer.cs (1)
42stringArgumentNode.Expression is LiteralExpressionSyntax containedLiteralExpressionSyntax)
Microsoft.NetCore.Analyzers\Runtime\CSharpForwardCancellationTokenToInvocations.Fixer.cs (1)
74return newArguments.Select(x => x.Expression);
Microsoft.NetCore.Analyzers\Runtime\CSharpPreferStreamAsyncMemoryOverloads.Fixer.cs (5)
62arg1.Expression is IdentifierNameSyntax firstArgumentIdentifierName) 66arg2.Expression is LiteralExpressionSyntax literal && 71arg3.Expression is MemberAccessExpressionSyntax thirdArgumentMemberAccessExpression && 106actualNode = argument.Expression; 121actualNode = argument.Expression;
Microsoft.NetCore.Analyzers\Runtime\CSharpTestForEmptyStringsUsingStringLength.Fixer.cs (1)
21return node is ArgumentSyntax argumentSyntax ? argumentSyntax.Expression : node;
Microsoft.NetCore.Analyzers\Runtime\CSharpTestForNaNCorrectly.Fixer.cs (1)
21return node is ArgumentSyntax argumentSyntax ? argumentSyntax.Expression : node;
Microsoft.NetCore.Analyzers\Runtime\CSharpUseOrdinalStringComparison.Fixer.cs (2)
25((ArgumentSyntax)node).Expression.IsKind(SyntaxKind.SimpleMemberAccessExpression); 30if (((ArgumentSyntax)argument)?.Expression is MemberAccessExpressionSyntax memberAccess)
Microsoft.NetCore.Analyzers\Usage\CSharpDoNotPassNonNullableValueToArgumentNullExceptionThrowIfNullFixer.cs (1)
22var nullableStructExpression = invocation.ArgumentList.Arguments[0].Expression;
Microsoft.CodeAnalysis.CSharp.Workspaces (26)
CodeGeneration\CSharpSyntaxGenerator.cs (2)
960if (node is ArgumentSyntax arg && arg.Expression != null) 962return SyntaxFactory.AttributeArgument(null, arg.NameColon, arg.Expression);
Recommendations\CSharpRecommendationServiceRunner.cs (1)
481if (argument.Expression is IdentifierNameSyntax { Identifier.ValueText: var argumentIdentifier } &&
Simplification\CSharpSimplificationService.Expander.cs (7)
257var inferredName = node.Expression.TryGetInferredMemberName(); 271var argumentType = _semanticModel.GetTypeInfo(node.Expression).ConvertedType; 274node.Expression.Kind() != SyntaxKind.DeclarationExpression && 277if (TryCastTo(argumentType, node.Expression, newArgument.Expression, out var newArgumentExpressionWithCast)) 303elementName = argument.Expression?.TryGetInferredMemberName(); 792var typeinfo = semanticModel.GetTypeInfo(argument.Expression);
Simplification\Reducers\CSharpExtensionMethodReducer.cs (1)
73var expression = argumentList.Arguments[0].Expression.Parenthesize();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
56stylePreferences, argument.Expression, semanticModel, tupleElementType, cancellationToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
198argument.Expression == expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (4)
88if (nodeParent.GetRequiredParent().ChildNodes().OfType<ArgumentSyntax>().Any(a => a.Expression.IsKind(opposite))) 200if (nodeParent is ArgumentSyntax argument && argument.Expression == node) 667previousExpression = argumentList.Arguments[argumentIndex - 1].Expression; 702nextExpression = argumentList.Arguments[argumentIndex + 1].Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
590=> ((ArgumentSyntax)node).Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (2)
29var inferredName = node.Expression.TryGetInferredMemberName(); 72if (argument.NameColon is null && argument.Expression.TryGetInferredMemberName()?.Equals(name) == true)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
107if (existingArgument.Expression is InvocationExpressionSyntax { ArgumentList.Arguments: [{ Expression: var nameofArgument }] } invocation &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (1)
18return DetermineParameterType(argument.Expression, semanticModel, cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (1)
108argument.Expression, capitalize: false, cancellationToken: cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1835var argumentExpression = invocation.ArgumentList.Arguments[0].Expression; 2383var expr = arg.Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
31=> new(argument.GetRefKind(), argument.NameColon?.Name.Identifier.ValueText, argument.Expression);
Microsoft.DotNet.CodeAnalysis (1)
Analyzers\AppContextDefaultsAnalyzer.cs (1)
74if (args.Expression.Kind() != SyntaxKind.TrueLiteralExpression)
Microsoft.Maui.Controls.BindingSourceGen (9)
BindingSourceGenerator.cs (6)
58 && invocation.ArgumentList.Arguments[1].Expression is not LiteralExpressionSyntax 59 && invocation.ArgumentList.Arguments[1].Expression is not ObjectCreationExpressionSyntax; 68 && invocation.ArgumentList.Arguments[0].Expression is not LiteralExpressionSyntax 69 && invocation.ArgumentList.Arguments[0].Expression is not ObjectCreationExpressionSyntax 170 InterceptedMethodType.SetBinding => argumentList[1].Expression, 171 InterceptedMethodType.Create => argumentList[0].Expression,
InvocationParser.cs (2)
53 var firstArgument = argumentsList[0].Expression; // Guaranteed to have at least one argument (checked by the caller) 94 var secondArgument = argumentsList[1].Expression;
PathParser.cs (1)
183 var indexExpression = argumentList[0].Expression;
Microsoft.ML.InternalCodeAnalyzer (11)
ContractsCheckAnalyzer.cs (5)
229if (!NameIsNameof(arg.Expression)) 232NameofDiagnostic.Rule, arg.GetLocation(), name, parameter.Name, arg.Expression)); 236if (isCheck && !IsGoodMessage(context, arg.Expression)) 239SimpleMessageDiagnostic.Rule, arg.GetLocation(), name, arg.Expression)); 244DecodeMessageWithLoadContextDiagnostic.Rule, arg.GetLocation(), name, arg.Expression));
ContractsCheckNameofFixProvider.cs (6)
45string nameArgValue = (nameArg.Expression as LiteralExpressionSyntax)?.Token.ValueText; 60argList.Arguments[0].Expression.GetText(); 62argList.Arguments[1] == nameArg && argList.Arguments[0].Expression.ToString() == nameArgValue) 172var newRoot = root.ReplaceNode(nameArg.Expression, nameofExp); 179var newNameofExp = nameofExp.ReplaceNode(nameofExp.ArgumentList.Arguments[0].Expression, exp.WithoutTrivia()); 183var newRoot = root.ReplaceNode(nameArg.Expression, newNameofExp);
Roslyn.Diagnostics.CSharp.Analyzers (16)
CSharpSymbolDeclaredEventMustBeGeneratedForSourceSymbols.cs (1)
58return argument.Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
56stylePreferences, argument.Expression, semanticModel, tupleElementType, cancellationToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
198argument.Expression == expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (4)
88if (nodeParent.GetRequiredParent().ChildNodes().OfType<ArgumentSyntax>().Any(a => a.Expression.IsKind(opposite))) 200if (nodeParent is ArgumentSyntax argument && argument.Expression == node) 667previousExpression = argumentList.Arguments[argumentIndex - 1].Expression; 702nextExpression = argumentList.Arguments[argumentIndex + 1].Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
590=> ((ArgumentSyntax)node).Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (2)
29var inferredName = node.Expression.TryGetInferredMemberName(); 72if (argument.NameColon is null && argument.Expression.TryGetInferredMemberName()?.Equals(name) == true)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
107if (existingArgument.Expression is InvocationExpressionSyntax { ArgumentList.Arguments: [{ Expression: var nameofArgument }] } invocation &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (1)
18return DetermineParameterType(argument.Expression, semanticModel, cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (1)
108argument.Expression, capitalize: false, cancellationToken: cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1835var argumentExpression = invocation.ArgumentList.Arguments[0].Expression; 2383var expr = arg.Expression;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
31=> new(argument.GetRefKind(), argument.NameColon?.Name.Identifier.ValueText, argument.Expression);
System.Windows.Forms.PrivateSourceGenerators (1)
System\Windows\Forms\SourceGenerators\EnumValidationGenerator.cs (1)
71var argumentToValidate = arguments.First().Expression;