334 references to Expression
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.cs (1)
132
routePatternArgumentSyntax.
Expression
is not LiteralExpressionSyntax routePatternArgumentLiteralSyntax)
Microsoft.AspNetCore.App.Analyzers (6)
Kestrel\ListenOnIPv6AnyAnalyzer.cs (1)
63
Expression
: MemberAccessExpressionSyntax
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
417
if (argument.
Expression
is DeclarationExpressionSyntax declarationExpression &&
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (2)
300
if (routeStringArgument?.
Expression
is not LiteralExpressionSyntax literalExpression)
305
return new MapMethodParts(method, literalExpression, delegateArgument.
Expression
);
RouteHandlers\RouteHandlerAnalyzer.cs (1)
185
routePatternArgumentSyntax.
Expression
is not LiteralExpressionSyntax routePatternArgumentLiteralSyntax)
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
369
var 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)
130
arguments[1].
Expression
);
Http\HeaderDictionaryIndexerFixer.cs (1)
54
param = argumentSyntax.
Expression
;
WebApplicationBuilderFixer.cs (1)
114
|| initArgument.
Expression
is not LambdaExpressionSyntax lambdaExpr)
Microsoft.AspNetCore.OpenApi.SourceGenerators (2)
XmlCommentGenerator.Parser.cs (2)
172
if (argument.
Expression
is LiteralExpressionSyntax)
176
else if (argument.
Expression
is LambdaExpressionSyntax)
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (2)
HubClientProxyGenerator.Parser.cs (2)
260
var argModel = _compilation.GetSemanticModel(als.Arguments[0].
Expression
.SyntaxTree);
261
var argTypeInfo = argModel.GetTypeInfo(als.Arguments[0].
Expression
);
Microsoft.CodeAnalysis.CSharp (22)
Binder\Binder_Deconstruct.cs (1)
785
builder.Add(BindDeconstructionVariables(arg.
Expression
, diagnostics, ref declaration, ref expression));
Binder\Binder_Expressions.cs (8)
1013
ImmutableArray.Create(BindValue(arguments[0].
Expression
, diagnostics, BindValueKind.RValue)) :
1043
BoundExpression boundArgument = BindValue(argumentSyntax.
Expression
, diagnostics, BindValueKind.RValue);
1113
inferredName = InferTupleElementName(argumentSyntax.
Expression
);
3068
switch (argumentSyntax.
Expression
.Kind())
3130
argumentSyntax.
Expression
.CheckDeconstructionCompatibleArgument(diagnostics);
3139
if (argumentSyntax.
Expression
.Kind() == SyntaxKind.DeclarationExpression)
3144
var declarationExpression = (DeclarationExpressionSyntax)argumentSyntax.
Expression
;
3151
return BindArgumentExpression(diagnostics, argumentSyntax.
Expression
, refKind, allowArglist);
Binder\Binder_Invocation.cs (2)
2297
if (binder.EnclosingNameofArgument == node.ArgumentList.Arguments[0].
Expression
)
2311
var argument = node.ArgumentList.Arguments[0].
Expression
;
Binder\ExpressionVariableFinder.cs (2)
90
Visit(arg.
Expression
);
476
CollectVariablesFromDeconstruction(arg.
Expression
, deconstruction);
Binder\ForEachLoopBinder.cs (1)
115
CollectLocalsFromDeconstruction(arg.
Expression
, kind, locals, deconstructionStatement, enclosingBinderOpt);
Binder\LocalBinderFactory.cs (1)
233
var argumentExpression = node.ArgumentList.Arguments[0].
Expression
;
Symbols\Source\SourceFixedFieldSymbol.cs (2)
73
if (arguments.Count == 0 || arguments[0].
Expression
.Kind() == SyntaxKind.OmittedArraySizeExpression)
84
ExpressionSyntax sizeExpression = arguments[0].
Expression
;
Syntax.xml.Main.Generated.cs (1)
1654
=> node.Update((NameColonSyntax?)Visit(node.NameColon), VisitToken(node.RefKindKeyword), (ExpressionSyntax?)Visit(node.
Expression
) ?? throw new ArgumentNullException("expression"));
Syntax.xml.Syntax.Generated.cs (3)
2779
if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.
Expression
)
2789
public ArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(nameColon, this.RefKindKeyword, this.
Expression
);
2790
public ArgumentSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(this.NameColon, refKindKeyword, this.
Expression
);
Syntax\ArgumentSyntax.cs (1)
26
return this.Update(this.NameColon, refOrOutKeyword, this.
Expression
);
Microsoft.CodeAnalysis.CSharp.Analyzers (3)
MetaAnalyzers\CSharpRegisterActionAnalyzer.cs (2)
60
return invocation.ArgumentList.Arguments.Select(a => a.
Expression
);
68
return argument.
Expression
;
MetaAnalyzers\CSharpReportDiagnosticAnalyzer.cs (1)
33
return invocation.ArgumentList.Arguments.Select(a => a.
Expression
);
Microsoft.CodeAnalysis.CSharp.CodeStyle (31)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
88
var argumentExpression = argumentNode.
Expression
;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
103
if (argument.
Expression
is not IdentifierNameSyntax argumentIdentifier)
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
110
ArgumentList.Arguments: [{
Expression
: LambdaExpressionSyntax whereLambda1 }],
150
Expression
: LambdaExpressionSyntax
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
60
AddIneligibleFieldsForExpression(argument.
Expression
);
64
if (argument.
Expression
.IsNameOfArgumentExpression())
65
AddIneligibleFieldsForExpression(argument.
Expression
, alwaysRestricted: true);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
149
argumentIndex == arguments.Count - 1 && arguments[argumentIndex] is { RefKindKeyword.RawKind: (int)SyntaxKind.OutKeyword,
Expression
: DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax singleVariable } }
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
238
var argumentType = semanticModel.GetTypeInfo(objectCreation.ArgumentList.Arguments[0].
Expression
, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (7)
570
if (argument.
Expression
.IsNameOfArgumentExpression())
612
siblingArgument.
Expression
is DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax designation })
823
if (semanticModel.GetConstantValue(elementArgument.
Expression
, cancellationToken).Value is not int indexValue ||
963
if (arguments is [{
Expression
: ArrayCreationExpressionSyntax { Initializer: not null } or ImplicitArrayCreationExpressionSyntax }])
991
if (arguments[0].
Expression
1012
var argExpression = argument.
Expression
;
1194
var expression = arguments.Single().
Expression
;
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (3)
79
preMatches.Add(new(argumentList.Arguments[0].
Expression
, UseSpread: true));
106
spreadElements.Add(invocation.ArgumentList.Arguments[0].
Expression
);
124
var currentArgumentExpression = argumentList.Arguments[0].
Expression
;
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
195
var arg0 = invocation.ArgumentList.Arguments[0].
Expression
;
196
var arg1 = invocation.ArgumentList.Arguments[1].
Expression
;
src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (1)
37
=> ((ArgumentSyntax)syntaxNode).
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
56
stylePreferences, argument.
Expression
, semanticModel, tupleElementType, cancellationToken))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
198
argument.
Expression
== expression;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (4)
89
if (nodeParent.GetRequiredParent().ChildNodes().OfType<ArgumentSyntax>().Any(a => a.
Expression
.IsKind(opposite)))
201
if (nodeParent is ArgumentSyntax argument && argument.
Expression
== node)
645
previousExpression = argumentList.Arguments[argumentIndex - 1].
Expression
;
680
nextExpression = argumentList.Arguments[argumentIndex + 1].
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
583
=> ((ArgumentSyntax)node).
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (2)
29
var inferredName = node.
Expression
.TryGetInferredMemberName();
72
if (argument.NameColon is null && argument.
Expression
.TryGetInferredMemberName()?.Equals(name) == true)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (19)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\ArgumentFixer.cs (2)
18
=> argument.
Expression
;
21
=> oldArgument.WithExpression(oldArgument.
Expression
.Cast(conversionType));
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
166
var argumentExpression = tuple.Arguments[i].
Expression
;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
830
return arguments.SelectAsArray(a => indent(a.
Expression
));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForCreateCodeFixProvider.cs (1)
65
var expressions = dummyObjectCreation.ArgumentList.Arguments.Select(a => a.
Expression
);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (2)
117
if (match.UseSpread && argument.
Expression
is CollectionExpressionSyntax collectionExpression)
133
result.Add(new(argument.
Expression
, match.UseSpread));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForNewCodeFixProvider.cs (1)
66
var expressions = dummyObjectCreation.ArgumentList.Arguments.Select(a => a.
Expression
);
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
126
var expression = arguments[0].
Expression
;
137
arguments.Select(a => a.
Expression
),
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
134
a => a.
Expression
.Kind() != SyntaxKind.DefaultLiteralExpression && Equals(arrayElementType, semanticModel.GetTypeInfo(a.
Expression
).Type));
164
.Select(a => a.IsNode ? ((ArgumentSyntax)a.AsNode()!).
Expression
: a);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
108
if (existingArgument.Expression is InvocationExpressionSyntax { ArgumentList.Arguments: [{
Expression
: var nameofArgument }] } invocation &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (1)
18
return DetermineParameterType(argument.
Expression
, semanticModel, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (1)
108
argument.
Expression
, capitalize: false, cancellationToken: cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1757
var argumentExpression = invocation.ArgumentList.Arguments[0].
Expression
;
2305
var expr = arg.
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
31
=> new(argument.GetRefKind(), argument.NameColon?.Name.Identifier.ValueText, argument.
Expression
);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
SymbolKey\SymbolKeyTestBase.cs (2)
325
var df = model.AnalyzeDataFlow(a.
Expression
);
330
GetAnonymousExprSymbols(a.
Expression
, model, list);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (39)
CodeGen\CodeGenDeconstructTests.cs (1)
3489
var nestedLiteral = literal.Arguments[1].
Expression
;
CodeGen\CodeGenTupleEqualityTests.cs (21)
367
var lastX = tupleX.Arguments[1].
Expression
;
385
var lastY = tupleY.Arguments[1].
Expression
;
693
Assert.Equal(1, model.GetConstantValue(tuple2.Arguments[1].
Expression
).Value);
799
var tuple1Null = tuple1.Arguments[1].
Expression
;
812
var tuple2Null = tuple2.Arguments[0].
Expression
;
874
var two = tuple.Arguments[1].
Expression
;
922
var two = tuple.Arguments[1].
Expression
;
970
var t2 = tuple.Arguments[1].
Expression
;
1017
var nullNull = (TupleExpressionSyntax)lastTuple.Arguments[1].
Expression
;
1024
var lastNull = nullNull.Arguments[1].
Expression
;
1317
var lastDefault = lastTuple.Arguments[1].
Expression
;
1506
var t = tuple.Arguments[1].
Expression
;
1517
var nestedTuple = (TupleExpressionSyntax)tuple.Arguments[0].
Expression
;
1528
var nestedNull = nestedTuple.Arguments[0].
Expression
;
1625
var nestedTuple = (TupleExpressionSyntax)rightTuple.Arguments[0].
Expression
;
1631
var two = nestedTuple.Arguments[1].
Expression
;
1691
var firstLambda = tuple2.Arguments[1].
Expression
;
1696
var methodGroup = tuple2.Arguments[2].
Expression
;
1703
var secondLambda = tuple2.Arguments[3].
Expression
;
5177
var leftNull = leftTuple.Arguments[0].
Expression
;
5185
var leftNestedTuple = leftTuple.Arguments[1].
Expression
;
CodeGen\CodeGenTupleTest.cs (17)
8340
element = node.Arguments[0].
Expression
;
8345
element = node.Arguments[1].
Expression
;
8445
element = node.Arguments[0].
Expression
;
8450
element = node.Arguments[1].
Expression
;
8589
element = node.Arguments[0].
Expression
;
8594
element = node.Arguments[1].
Expression
;
8767
element = node.Arguments[0].
Expression
;
8772
element = node.Arguments[1].
Expression
;
8950
element = node.Arguments[0].
Expression
;
8955
element = node.Arguments[1].
Expression
;
13975
var nameofArg = ((InvocationExpressionSyntax)nameofNode.Parent).ArgumentList.Arguments.Single().
Expression
;
25708
var first = tuple.Arguments[0].
Expression
;
25713
var second = tuple.Arguments[1].
Expression
;
25779
var first = tuple.Arguments[0].
Expression
;
25784
var second = tuple.Arguments[1].
Expression
;
25844
var first = tuple.Arguments[0].
Expression
;
25849
var second = tuple.Arguments[1].
Expression
;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (5)
Semantics\ParamsCollectionTests.cs (1)
171
var argument = nodes[1].ArgumentList.Arguments[0].
Expression
;
Semantics\PrimaryConstructorTests.cs (2)
6833
var xReference = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].
Expression
;
6859
var mCall = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].
Expression
;
Semantics\RecordTests.cs (2)
30476
var xReference = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].
Expression
;
30500
var mCall = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].
Expression
;
Microsoft.CodeAnalysis.CSharp.Features (58)
ChangeSignature\CSharpChangeSignatureService.cs (2)
656
lastArgumentExpression = lastArgument.
Expression
;
925
var 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)
245
tupleExpression.Arguments.Count(a => nonConflictReferences.Contains(a.
Expression
)) == 1)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (3)
631
switch (argumentSyntax.
Expression
?.Kind())
636
return ((DeclarationExpressionSyntax)argumentSyntax.
Expression
).Type;
641
return argumentSyntax.
Expression
;
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
262
var selectExpression = invocationExpression.ArgumentList.Arguments.Single().
Expression
;
Debugging\CSharpProximityExpressionsService.RelevantExpressionsCollector.cs (1)
119
AddVariableExpressions(a.
Expression
, expressions);
Debugging\CSharpProximityExpressionsService_ExpressionTermCollector.cs (2)
396
AddSubExpressionTerms(arg.
Expression
, terms, ref flags);
399
terms.Add(ConvertToString(arg.
Expression
));
EditAndContinue\SyntaxComparer.cs (1)
1341
GetLocalNames(argument.
Expression
, ref result);
GenerateType\CSharpGenerateTypeService.cs (1)
363
objectCreationExpressionOpt.ArgumentList.Arguments is [{
Expression
: (kind: not SyntaxKind.DeclarationExpression) expression }])
InlineHints\CSharpInlineParameterNameHintsService.cs (1)
82
buffer.Add((argument.Span.Start, argument, parameter, GetKind(argument.
Expression
)));
IntroduceVariable\CSharpIntroduceVariableService.Rewriter.cs (2)
64
newNode.
Expression
.HasAnnotation(s_replacementAnnotation) &&
67
var inferredName = node.
Expression
.TryGetInferredMemberName();
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (2)
322
invocation.ArgumentList.Arguments[0].
Expression
.Kind() == SyntaxKind.DeclarationExpression)
341
var argumentExpression = currentInvocation.ArgumentList.Arguments[0].
Expression
.Parenthesize();
SignatureHelp\LightweightOverloadResolution.cs (4)
116
if (IsEmptyArgument(argument.
Expression
))
127
&& semanticModel.ClassifyConversion(argument.
Expression
, arrayType.ElementType).IsImplicit)
132
return semanticModel.ClassifyConversion(argument.
Expression
, type).IsImplicit;
202
else if (IsEmptyArgument(argument.
Expression
))
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
88
var argumentExpression = argumentNode.
Expression
;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
103
if (argument.
Expression
is not IdentifierNameSyntax argumentIdentifier)
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
110
ArgumentList.Arguments: [{
Expression
: LambdaExpressionSyntax whereLambda1 }],
150
Expression
: LambdaExpressionSyntax
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
60
AddIneligibleFieldsForExpression(argument.
Expression
);
64
if (argument.
Expression
.IsNameOfArgumentExpression())
65
AddIneligibleFieldsForExpression(argument.
Expression
, alwaysRestricted: true);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
149
argumentIndex == arguments.Count - 1 && arguments[argumentIndex] is { RefKindKeyword.RawKind: (int)SyntaxKind.OutKeyword,
Expression
: DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax singleVariable } }
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
238
var argumentType = semanticModel.GetTypeInfo(objectCreation.ArgumentList.Arguments[0].
Expression
, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (7)
570
if (argument.
Expression
.IsNameOfArgumentExpression())
612
siblingArgument.
Expression
is DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax designation })
823
if (semanticModel.GetConstantValue(elementArgument.
Expression
, cancellationToken).Value is not int indexValue ||
963
if (arguments is [{
Expression
: ArrayCreationExpressionSyntax { Initializer: not null } or ImplicitArrayCreationExpressionSyntax }])
991
if (arguments[0].
Expression
1012
var argExpression = argument.
Expression
;
1194
var expression = arguments.Single().
Expression
;
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (3)
79
preMatches.Add(new(argumentList.Arguments[0].
Expression
, UseSpread: true));
106
spreadElements.Add(invocation.ArgumentList.Arguments[0].
Expression
);
124
var currentArgumentExpression = argumentList.Arguments[0].
Expression
;
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
195
var arg0 = invocation.ArgumentList.Arguments[0].
Expression
;
196
var arg1 = invocation.ArgumentList.Arguments[1].
Expression
;
src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (1)
37
=> ((ArgumentSyntax)syntaxNode).
Expression
;
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\ArgumentFixer.cs (2)
18
=> argument.
Expression
;
21
=> oldArgument.WithExpression(oldArgument.
Expression
.Cast(conversionType));
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
166
var argumentExpression = tuple.Arguments[i].
Expression
;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
830
return arguments.SelectAsArray(a => indent(a.
Expression
));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForCreateCodeFixProvider.cs (1)
65
var expressions = dummyObjectCreation.ArgumentList.Arguments.Select(a => a.
Expression
);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (2)
117
if (match.UseSpread && argument.
Expression
is CollectionExpressionSyntax collectionExpression)
133
result.Add(new(argument.
Expression
, match.UseSpread));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForNewCodeFixProvider.cs (1)
66
var expressions = dummyObjectCreation.ArgumentList.Arguments.Select(a => a.
Expression
);
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
126
var expression = arguments[0].
Expression
;
137
arguments.Select(a => a.
Expression
),
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
134
a => 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.Semantic.UnitTests (40)
Semantics\BetterCandidates.cs (1)
1268
var symbolInfo = model.GetSymbolInfo(invocations[0].ArgumentList.Arguments[0].
Expression
);
Semantics\DelegateTypeTests.cs (1)
11164
var identifiers = nodes.OfType<InvocationExpressionSyntax>().Where(i => i.Expression is IdentifierNameSyntax id && id.Identifier.Text == "Report").Select(i => i.ArgumentList.Arguments[0].
Expression
).ToArray();
Semantics\DynamicTests.cs (7)
10054
var rightElement = right.Arguments[0].
Expression
;
10182
var rightElement = right.Arguments[0].
Expression
;
10310
var rightElement = right.Arguments[0].
Expression
;
10464
var rightElement = right.Arguments[0].
Expression
;
11134
right = (TupleExpressionSyntax)right.Arguments[0].
Expression
;
11139
var rightElement = right.Arguments[0].
Expression
;
11218
var rightElement = right.Arguments[0].
Expression
;
Semantics\FunctionPointerTests.cs (1)
204
assertResult(model, parameter.
Expression
, comp);
Semantics\ImplicitObjectCreationTests.cs (1)
4194
var newExpression = ((InvocationExpressionSyntax)modifiedNode.Expression).ArgumentList.Arguments[0].
Expression
;
Semantics\LocalFunctionTests.cs (2)
6555
Select(n => n.ArgumentList.Arguments[0].
Expression
).
10431
var p = nameof.ArgumentList.Arguments[0].
Expression
;
Semantics\NameOfTests.cs (8)
993
var argument = nameofCalls[index].ArgumentList.Arguments.Single().
Expression
;
998
var argument2 = nameofCalls2[index].ArgumentList.Arguments.Single().
Expression
;
1064
var argument = nameofCalls[index].ArgumentList.Arguments.Single().
Expression
;
1069
var argument2 = nameofCalls2[index].ArgumentList.Arguments.Single().
Expression
;
1150
var argument = nameofCalls[index].ArgumentList.Arguments.Single().
Expression
;
1155
var argument2 = nameofCalls2[index].ArgumentList.Arguments.Single().
Expression
;
1228
var argument = nameofCalls[index].ArgumentList.Arguments.Single().
Expression
;
1233
var argument2 = nameofCalls2[index].ArgumentList.Arguments.Single().
Expression
;
Semantics\NullableReferenceTypesTests.cs (6)
71941
var discard1 = arguments.First().
Expression
;
71946
var discard2 = arguments.Skip(1).First().
Expression
;
71951
var discard3 = arguments.Skip(2).First().
Expression
;
71956
var discard4 = arguments.Skip(3).First().
Expression
;
71989
var discard1 = (DeclarationExpressionSyntax)arguments.First().
Expression
;
71999
var discard2 = arguments.Skip(1).First().
Expression
;
Semantics\UnsafeTests.cs (3)
8162
var indexSyntax = syntax.ArgumentList.Arguments.Single().
Expression
;
8229
var indexSyntax = syntax.ArgumentList.Arguments.Single().
Expression
;
8287
var indexSyntax = syntax.ArgumentList.Arguments.Single().
Expression
;
Semantics\ValueTupleTests.cs (10)
673
var firstTupleArgExpr = tupleExpression.Arguments[0].
Expression
;
678
var secondTupleArgExpr = tupleExpression.Arguments[1].
Expression
;
713
var firstTupleArgExpr = tupleExpression.Arguments[0].
Expression
;
718
var secondTupleArgExpr = tupleExpression.Arguments[1].
Expression
;
754
var firstTupleArgExpr = tupleExpression.Arguments[0].
Expression
;
759
var secondTupleArgExpr = tupleExpression.Arguments[1].
Expression
;
796
var firstTupleArgExpr = tupleExpression.Arguments[0].
Expression
;
801
var secondTupleArgExpr = tupleExpression.Arguments[1].
Expression
;
836
var firstTupleArgExpr = tupleExpression.Arguments[0].
Expression
;
841
var secondTupleArgExpr = tupleExpression.Arguments[1].
Expression
;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (19)
Compilation\GetSemanticInfoTests.cs (6)
264
ConversionTestHelper(model, v61[0].
Expression
, ConversionKind.ImplicitNumeric, ConversionKind.ImplicitNumeric);
299
var arg = call.ArgumentList.Arguments[0].
Expression
;
3472
var argexpr = expr.ArgumentList.Arguments.Single().
Expression
;
3526
var argexpr = expr.ArgumentList.Arguments.Single().
Expression
;
3586
var argTypeInfo = model.GetTypeInfo(expr.ArgumentList.Arguments.First().
Expression
);
5720
var methodGroupSyntax = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>().Single().
Expression
;
Compilation\SemanticModelAPITests.cs (6)
1202
var argsym1 = model.GetSymbolInfo(args.First().
Expression
).Symbol;
1203
var argsym2 = model.GetSymbolInfo(args.Last().
Expression
).Symbol;
1798
var arg = call.ArgumentList.Arguments[0].
Expression
;
1805
var arg2 = call2.ArgumentList.Arguments[0].
Expression
;
2404
var arg = call.ArgumentList.Arguments[0].
Expression
;
2412
var arg2 = call2.ArgumentList.Arguments[0].
Expression
;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (4)
2674
var arg = invocation.ArgumentList.Arguments[0].
Expression
;
2704
var info = model.GetSemanticInfoSummary(invocation.ArgumentList.Arguments[0].
Expression
);
2708
info = model.GetSemanticInfoSummary(invocation.ArgumentList.Arguments[1].
Expression
);
3283
var argument = invocation.ArgumentList.Arguments[0].
Expression
;
SymbolDisplay\SymbolDisplayTests.cs (1)
5750
var escapedThis = invocation.ArgumentList.Arguments[0].
Expression
;
Symbols\Source\NullablePublicAPITests.cs (1)
5159
var binaryRightArgument = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right.DescendantNodes().OfType<ArgumentSyntax>().Single().
Expression
;
Symbols\StaticAbstractMembersInInterfacesTests.cs (1)
14080
node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments[0].
Expression
;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (14)
Generated\Syntax.Test.xml.Generated.cs (2)
11680
Assert.NotNull(node.
Expression
);
11681
var newNode = node.WithNameColon(node.NameColon).WithRefKindKeyword(node.RefKindKeyword).WithExpression(node.
Expression
);
Parsing\ExpressionParsingTests.cs (11)
987
Assert.NotNull(cs.ArgumentList.Arguments[0].
Expression
);
988
Assert.Equal("b", cs.ArgumentList.Arguments[0].
Expression
.ToString());
1012
Assert.NotNull(cs.ArgumentList.Arguments[0].
Expression
);
1013
Assert.Equal("b", cs.ArgumentList.Arguments[0].
Expression
.ToString());
1038
Assert.Equal("b", cs.ArgumentList.Arguments[0].
Expression
.ToString());
1083
Assert.NotNull(ea.ArgumentList.Arguments[0].
Expression
);
1084
Assert.Equal("b", ea.ArgumentList.Arguments[0].
Expression
.ToString());
1108
Assert.NotNull(ea.ArgumentList.Arguments[0].
Expression
);
1109
Assert.Equal("b", ea.ArgumentList.Arguments[0].
Expression
.ToString());
2264
Assert.Equal(SyntaxKind.IdentifierName, tuple.Arguments[0].
Expression
.Kind());
2284
Assert.Equal(SyntaxKind.TupleExpression, tuple.Arguments[0].
Expression
.Kind());
Syntax\SyntaxListTests.cs (1)
306
Assert.Equal(expectedArgName, ((ArgumentSyntax)item).
Expression
.ToString());
Microsoft.CodeAnalysis.CSharp.Workspaces (26)
CodeGeneration\CSharpSyntaxGenerator.cs (2)
973
if (node is ArgumentSyntax arg && arg.
Expression
!= null)
975
return SyntaxFactory.AttributeArgument(null, arg.NameColon, arg.
Expression
);
Recommendations\CSharpRecommendationServiceRunner.cs (1)
481
if (argument.
Expression
is IdentifierNameSyntax { Identifier.ValueText: var argumentIdentifier } &&
Simplification\CSharpSimplificationService.Expander.cs (7)
257
var inferredName = node.
Expression
.TryGetInferredMemberName();
271
var argumentType = _semanticModel.GetTypeInfo(node.
Expression
).ConvertedType;
274
node.
Expression
.Kind() != SyntaxKind.DeclarationExpression &&
277
if (TryCastTo(argumentType, node.
Expression
, newArgument.
Expression
, out var newArgumentExpressionWithCast))
303
elementName = argument.
Expression
?.TryGetInferredMemberName();
792
var typeinfo = semanticModel.GetTypeInfo(argument.
Expression
);
Simplification\Reducers\CSharpExtensionMethodReducer.cs (1)
73
var expression = argumentList.Arguments[0].
Expression
.Parenthesize();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
56
stylePreferences, argument.
Expression
, semanticModel, tupleElementType, cancellationToken))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
198
argument.
Expression
== expression;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (4)
89
if (nodeParent.GetRequiredParent().ChildNodes().OfType<ArgumentSyntax>().Any(a => a.
Expression
.IsKind(opposite)))
201
if (nodeParent is ArgumentSyntax argument && argument.
Expression
== node)
645
previousExpression = argumentList.Arguments[argumentIndex - 1].
Expression
;
680
nextExpression = argumentList.Arguments[argumentIndex + 1].
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
583
=> ((ArgumentSyntax)node).
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (2)
29
var inferredName = node.
Expression
.TryGetInferredMemberName();
72
if (argument.NameColon is null && argument.
Expression
.TryGetInferredMemberName()?.Equals(name) == true)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
108
if (existingArgument.Expression is InvocationExpressionSyntax { ArgumentList.Arguments: [{
Expression
: var nameofArgument }] } invocation &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (1)
18
return DetermineParameterType(argument.
Expression
, semanticModel, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (1)
108
argument.
Expression
, capitalize: false, cancellationToken: cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1757
var argumentExpression = invocation.ArgumentList.Arguments[0].
Expression
;
2305
var expr = arg.
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
31
=> new(argument.GetRefKind(), argument.NameColon?.Name.Identifier.ValueText, argument.
Expression
);
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SyntaxPathTests.cs (1)
61
var path = new SyntaxPath(((InvocationExpressionSyntax)root).ArgumentList.Arguments.First().
Expression
);
Microsoft.DotNet.CodeAnalysis (1)
Analyzers\AppContextDefaultsAnalyzer.cs (1)
74
if (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)
229
if (!NameIsNameof(arg.
Expression
))
232
NameofDiagnostic.Rule, arg.GetLocation(), name, parameter.Name, arg.
Expression
));
236
if (isCheck && !IsGoodMessage(context, arg.
Expression
))
239
SimpleMessageDiagnostic.Rule, arg.GetLocation(), name, arg.
Expression
));
244
DecodeMessageWithLoadContextDiagnostic.Rule, arg.GetLocation(), name, arg.
Expression
));
ContractsCheckNameofFixProvider.cs (6)
45
string nameArgValue = (nameArg.
Expression
as LiteralExpressionSyntax)?.Token.ValueText;
60
argList.Arguments[0].
Expression
.GetText();
62
argList.Arguments[1] == nameArg && argList.Arguments[0].
Expression
.ToString() == nameArgValue)
172
var newRoot = root.ReplaceNode(nameArg.
Expression
, nameofExp);
179
var newNameofExp = nameofExp.ReplaceNode(nameofExp.ArgumentList.Arguments[0].
Expression
, exp.WithoutTrivia());
183
var newRoot = root.ReplaceNode(nameArg.
Expression
, newNameofExp);
Microsoft.VisualStudio.LanguageServices.CSharp (2)
CodeModel\MethodXml\MethodXmlBuilder.cs (2)
586
if (!TryGenerateExpression(argument.
Expression
))
600
return TryGenerateExpression(argument.
Expression
);
Roslyn.Diagnostics.CSharp.Analyzers (16)
CSharpSymbolDeclaredEventMustBeGeneratedForSourceSymbols.cs (1)
58
return argument.
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
56
stylePreferences, argument.
Expression
, semanticModel, tupleElementType, cancellationToken))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
198
argument.
Expression
== expression;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (4)
89
if (nodeParent.GetRequiredParent().ChildNodes().OfType<ArgumentSyntax>().Any(a => a.
Expression
.IsKind(opposite)))
201
if (nodeParent is ArgumentSyntax argument && argument.
Expression
== node)
645
previousExpression = argumentList.Arguments[argumentIndex - 1].
Expression
;
680
nextExpression = argumentList.Arguments[argumentIndex + 1].
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
583
=> ((ArgumentSyntax)node).
Expression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (2)
29
var inferredName = node.
Expression
.TryGetInferredMemberName();
72
if (argument.NameColon is null && argument.
Expression
.TryGetInferredMemberName()?.Equals(name) == true)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\AttributeGenerator.cs (1)
108
if (existingArgument.Expression is InvocationExpressionSyntax { ArgumentList.Arguments: [{
Expression
: var nameofArgument }] } invocation &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (1)
18
return DetermineParameterType(argument.
Expression
, semanticModel, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (1)
108
argument.
Expression
, capitalize: false, cancellationToken: cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1757
var argumentExpression = invocation.ArgumentList.Arguments[0].
Expression
;
2305
var expr = arg.
Expression
;
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)
71
var argumentToValidate = arguments.First().
Expression
;