561 references to ArgumentSyntax
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.cs (1)
131if (argumentOperation?.Syntax is not ArgumentSyntax routePatternArgumentSyntax ||
Microsoft.AspNetCore.App.Analyzers (12)
Kestrel\ListenOnIPv6AnyAnalyzer.cs (2)
54var ipAddressArgumentSyntax = args.Arguments.FirstOrDefault(); 61if (ipAddressArgumentSyntax is ArgumentSyntax
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
415foreach (var argument in tupleExpression.Arguments)
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (2)
373=> ((ArgumentSyntax)argument).DetermineParameter(semanticModel, allowUncertainCandidates, allowParams: false, cancellationToken); 384this ArgumentSyntax argument,
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (4)
284var delegateArgument = GetArgumentSyntax(argumentList, method, delegateParameter); 299var routeStringArgument = GetArgumentSyntax(argumentList, method, routeStringParameter); 308private static ArgumentSyntax? GetArgumentSyntax(BaseArgumentListSyntax argumentList, IMethodSymbol methodSymbol, IParameterSymbol parameterSymbol) 310foreach (var argument in argumentList.Arguments)
RouteHandlers\RouteHandlerAnalyzer.cs (1)
184if (argumentOperation?.Syntax is not ArgumentSyntax routePatternArgumentSyntax ||
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (2)
368var arguments = argument?.Syntax as ArgumentSyntax;
Microsoft.AspNetCore.App.CodeFixes (3)
Http\HeaderDictionaryIndexerFixer.cs (1)
52if (param is ArgumentSyntax argumentSyntax)
Kestrel\ListenOnIPv6AnyFixer.cs (2)
40var argumentSyntax = root.FindNode(diagnostic.Location.SourceSpan).FirstAncestorOrSelf<ArgumentSyntax>();
Microsoft.CodeAnalysis.CSharp (39)
Binder\Binder_Deconstruct.cs (1)
760else if (node.Parent is not ArgumentSyntax)
Binder\Binder_Expressions.cs (9)
999SeparatedSyntaxList<ArgumentSyntax> arguments = node.Arguments; 1024ArgumentSyntax argumentSyntax = arguments[i]; 1079SeparatedSyntaxList<ArgumentSyntax> arguments, BindingDiagnosticBag diagnostics) 1089ArgumentSyntax argumentSyntax = arguments[i]; 1837((ArgumentSyntax)parent).RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword); 3014private bool RefMustBeObeyed(bool isDelegateCreation, ArgumentSyntax argumentSyntax) 3047ArgumentSyntax argumentSyntax, 3087private BoundExpression BindArgumentValue(BindingDiagnosticBag diagnostics, ArgumentSyntax argumentSyntax, bool allowArglist, RefKind refKind) 3288Debug.Assert(argumentSyntax is ArgumentSyntax || argumentSyntax is AttributeArgumentSyntax);
Binder\Binder_Symbols.cs (1)
1014case ArgumentSyntax parent when // nameof(nint)
Binder\ExpressionVariableFinder.cs (4)
88foreach (ArgumentSyntax arg in node.ArgumentList.Arguments) 410var argumentSyntax = node.Parent as ArgumentSyntax; 474foreach (ArgumentSyntax arg in tuple.Arguments)
Compilation\CSharpSemanticModel.cs (4)
3134public abstract ISymbol GetDeclaredSymbol(ArgumentSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)); 4496var tupleArgument = (ArgumentSyntax)identifierNameSyntax.Parent.Parent; 5108return this.GetDeclaredSymbol((ArgumentSyntax)node, cancellationToken);
Compilation\MemberSemanticModel.cs (1)
1112public override ISymbol GetDeclaredSymbol(ArgumentSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
440public override ISymbol GetDeclaredSymbol(ArgumentSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (1)
466public override ISymbol GetDeclaredSymbol(ArgumentSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
CSharpExtensions.cs (1)
1481public static ISymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, ArgumentSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
Operations\CSharpOperationFactory_Methods.cs (1)
40(SyntaxNode syntax, bool isImplicit) = expression.Syntax is { Parent: ArgumentSyntax or AttributeArgumentSyntax } ? (expression.Syntax.Parent, expression.WasCompilerGenerated) : (value.Syntax, true);
Parser\LanguageParser.cs (10)
5377var args = _pool.AllocateSeparated<ArgumentSyntax>(); 11897arguments: out SeparatedSyntaxList<ArgumentSyntax> arguments, 11913arguments: out SeparatedSyntaxList<ArgumentSyntax> arguments, 11922out SeparatedSyntaxList<ArgumentSyntax> arguments, 11972var list = _pool.AllocateSeparated<ArgumentSyntax>(); 11991LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<ArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 12026private ArgumentSyntax ParseArgumentExpression(bool isIndexer) 12371private TupleExpressionSyntax ParseTupleExpressionTail(SyntaxToken openParen, ArgumentSyntax firstArg) 12373var list = _pool.AllocateSeparated<ArgumentSyntax>(); 12875default(SeparatedSyntaxList<ArgumentSyntax>),
Symbols\Source\SourceFixedFieldSymbol.cs (1)
70SeparatedSyntaxList<ArgumentSyntax> arguments = declarator.ArgumentList.Arguments;
Syntax\ArgumentSyntax.cs (1)
24public ArgumentSyntax WithRefOrOutKeyword(SyntaxToken refOrOutKeyword)
Syntax\SyntaxExtensions.cs (1)
387&& ((ArgumentSyntax)p.Parent).RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword;
Syntax\SyntaxNodeExtensions.cs (1)
59ArgumentSyntax argument = node.ArgumentList.Arguments[0];
Syntax\SyntaxNormalizer.cs (1)
1414or ArgumentSyntax)
Microsoft.CodeAnalysis.CSharp.CodeStyle (63)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (3)
81var argumentNode = (ArgumentSyntax)context.Node; 361ArgumentSyntax argumentNode,
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (2)
72foreach (var argument in codeBlock.DescendantNodesAndSelf().OfType<ArgumentSyntax>())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (11)
126using var _1 = ArrayBuilder<CollectionMatch<ArgumentSyntax>>.GetInstance(out var preMatchesInReverse); 127using var _2 = ArrayBuilder<CollectionMatch<ArgumentSyntax>>.GetInstance(out var postMatchesInReverse); 152ArrayBuilder<CollectionMatch<ArgumentSyntax>>? preMatchesInReverse, 153ArrayBuilder<CollectionMatch<ArgumentSyntax>>? postMatchesInReverse, 310postMatchesInReverse.Add(new CollectionMatch<ArgumentSyntax>( 320postMatchesInReverse.Add(new CollectionMatch<ArgumentSyntax>(Argument(expression), UseSpread: true)); 355ArrayBuilder<CollectionMatch<ArgumentSyntax>>? matchesInReverse, 356SeparatedSyntaxList<ArgumentSyntax> arguments, 379ArrayBuilder<CollectionMatch<ArgumentSyntax>>? matchesInReverse, 466ImmutableArray<CollectionMatch<ArgumentSyntax>> PreMatches, 467ImmutableArray<CollectionMatch<ArgumentSyntax>> PostMatches,
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (7)
447if (locallyScopedExpression.Parent is ArgumentSyntax argument) 568bool IsSafeUsageOfSpanAsArgument(ArgumentSyntax argument) 600bool AddRefLikeOutParameters(BaseArgumentListSyntax argumentList, ArgumentSyntax? argumentToSkip) 602foreach (var siblingArgument in argumentList.Arguments) 1007SemanticModel semanticModel, ArgumentSyntax argument, out bool unwrapArgument, out bool useSpread, CancellationToken cancellationToken) 1184public static SeparatedSyntaxList<ArgumentSyntax> GetArguments(ArgumentListSyntax argumentList, bool unwrapArgument) 1209: SeparatedList<ArgumentSyntax>(initializer.Expressions.GetWithSeparators().Select(
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (1)
39if (nameColon.Parent is not ArgumentSyntax argument)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (1)
167if (target.Syntax.DescendantNodesAndSelf().OfType<ArgumentSyntax>().Any(a => a.RefKindKeyword.Kind() is SyntaxKind.RefKeyword))
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
105else if (elements is [{ Syntax.Parent: ArgumentSyntax }, ..])
src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (3)
25foreach (var argument in arguments.Cast<ArgumentSyntax>()) 37=> ((ArgumentSyntax)syntaxNode).Expression;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
53var argument = tuple.Arguments[i];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (3)
14public static SyntaxTokenList GenerateParameterModifiers(this ArgumentSyntax argument) 24public static RefKind GetRefKind(this ArgumentSyntax? argument) 39this ArgumentSyntax argument,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (7)
198=> expression?.Parent is ArgumentSyntax { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) } argument && 214ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.RefKeyword }) 225=> expression?.Parent is ArgumentSyntax { RefKindKeyword: SyntaxToken(SyntaxKind.InKeyword) }; 385if (expression.Parent is ArgumentSyntax) 650=> expression is { Parent: ArgumentSyntax { Parent: ArgumentListSyntax { Parent: InvocationExpressionSyntax invocation } } } && 928ArgumentSyntax argument => GetTargetTypeForArgument(argument), 943ITypeSymbol? GetTargetTypeForArgument(ArgumentSyntax argument)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (5)
87nodeParent is ArgumentSyntax) 90if (nodeParent.GetRequiredParent().ChildNodes().OfType<ArgumentSyntax>().Any(a => a.Expression.IsKind(opposite))) 172if (nodeParent is ArgumentSyntax argument && argument.Expression == node) 618if (node.Parent is ArgumentSyntax argument) 653if (node.Parent is ArgumentSyntax argument)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
433if (topExpression?.Parent is ArgumentSyntax argument)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
256=> ((ArgumentSyntax)argument).DetermineParameter(semanticModel, allowUncertainCandidates, allowParams, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (5)
184=> node is ArgumentSyntax arg && arg.NameColon != null; 598=> ((ArgumentSyntax)node).Expression; 604=> ((ArgumentSyntax)node).GetRefKind(); 614return node is ArgumentSyntax argument && 1142=> (argument as ArgumentSyntax)?.NameColon?.Name.Identifier.ValueText ?? string.Empty;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (4)
13internal static bool CanSimplifyTupleElementName(ArgumentSyntax node, CSharpParseOptions parseOptions) 62private static bool RemovalCausesAmbiguity(SeparatedSyntaxList<ArgumentSyntax> arguments, ArgumentSyntax toRemove) 67foreach (var argument in arguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1463var argumentSyntax = argument?.Syntax as ArgumentSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (4)
34ArgumentSyntax, 588protected override ImmutableArray<ArgumentSyntax> GetArguments(ExpressionSyntax expression) 665protected override bool IsNamedArgument(ArgumentSyntax argument) 668protected override string GetNamedArgumentIdentifierValueText(ArgumentSyntax argument)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
217if (declarationExpression.Parent is not ArgumentSyntax
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (65)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\ArgumentFixer.cs (6)
15private sealed class ArgumentFixer : Fixer<ArgumentSyntax, ArgumentListSyntax, SyntaxNode> 17protected override ExpressionSyntax GetExpressionOfArgument(ArgumentSyntax argument) 20protected override ArgumentSyntax GenerateNewArgument(ArgumentSyntax oldArgument, ITypeSymbol conversionType) 23protected override ArgumentListSyntax GenerateNewArgumentList(ArgumentListSyntax oldArgumentList, ArrayBuilder<ArgumentSyntax> newArguments) 26protected override SeparatedSyntaxList<ArgumentSyntax> GetArgumentsOfArgumentList(ArgumentListSyntax argumentList)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\CSharpAddExplicitCastCodeFixProvider.cs (2)
70if (spanNode.GetAncestorOrThis<ArgumentSyntax>() is ArgumentSyntax targetArgument
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (5)
24ArgumentSyntax, 50=> ((ArgumentSyntax)argumentNode).DetermineParameterType(semanticModel, cancellationToken); 52protected override Argument<ExpressionSyntax> GetArgument(ArgumentSyntax argument) 55protected override RegisterFixData<ArgumentSyntax>? TryGetLanguageSpecificFixInfo( 76return new RegisterFixData<ArgumentSyntax>(arguments, methodCandidates, isConstructorInitializer: true);
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
70private static ImmutableArray<Argument<ExpressionSyntax>> GetArguments(SeparatedSyntaxList<ArgumentSyntax> arguments)
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (2)
56foreach (var argument in _invocationExpression.ArgumentList.Arguments) 134private ITypeSymbol DetermineParameterType(ArgumentSyntax argument, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (2)
104symbolAndCapture => (ArgumentSyntax)generator.Argument( 111newArgumentsList = newArgumentsList.Insert(0, (ArgumentSyntax)generator.Argument(generator.ThisExpression()));
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (2)
60if (node.Parent is ArgumentSyntax) 213if (node.Parent is ArgumentSyntax argument && argument.Parent?.Parent is InvocationExpressionSyntax invocation)
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (2)
42var argumentSyntax = token.GetAncestor<ArgumentSyntax>(); 56ArgumentSyntax argumentSyntax,
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (7)
105SeparatedSyntaxList<ArgumentSyntax> arguments, 106ImmutableArray<CollectionMatch<ArgumentSyntax>> matches, 114var argument = arguments[i + index]; 141static async Task<SeparatedSyntaxList<ArgumentSyntax>> GetArgumentsAsync( 143ImmutableArray<CollectionMatch<ArgumentSyntax>> matches, 181return SeparatedList<ArgumentSyntax>(nodesAndTokens); 183void AddOriginallyFirstArgument(ArgumentSyntax firstArgument)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
168SeparatedList<ArgumentSyntax>(new SyntaxNodeOrTokenList(typeNode.Elements.GetWithSeparators().Select(ConvertTupleTypeElementComponent))),
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
164.Select(a => a.IsNode ? ((ArgumentSyntax)a.AsNode()!).Expression : a); 169var wrappedArgument = Argument(canUseImplicitArray 176return argumentList.WithArguments(SeparatedList<ArgumentSyntax>(finalArgumentsWithSeparators));
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
180using var _ = ArrayBuilder<ArgumentSyntax>.GetInstance(elements.Length, out var builder);
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
89var argument = Argument(rangeExpression).WithAdditionalAnnotations(Formatter.Annotation);
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
180return argumentList.WithArguments(SeparatedList<ArgumentSyntax>(arguments));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ArgumentGenerator.cs (2)
13public static ArgumentSyntax GenerateArgument(SyntaxNode argument) 20return (ArgumentSyntax)argument;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (1)
25internal sealed class CSharpRefactoringHelpersService() : AbstractRefactoringHelpersService<ExpressionSyntax, ArgumentSyntax, ExpressionStatementSyntax>
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
675if (item.AsNode() is ArgumentSyntax node && node.NameColon != null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
1818token.Parent is ArgumentSyntax argument && 2875if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword })
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (1)
17this ArgumentSyntax argument,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (2)
54IEnumerable<ArgumentSyntax> arguments, 98this SemanticModel semanticModel, ArgumentSyntax argument, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (15)
139ArgumentSyntax argument => InferTypeInArgument(argument), 203ArgumentSyntax argument => InferTypeInArgument(argument, token), 268ArgumentSyntax argument, SyntaxToken? previousToken = null) 350return InferTypeInTupleExpression(tupleExpression, (ArgumentSyntax)argsAndCommas[commaIndex + 1]); 357TupleExpressionSyntax tupleExpression, ArgumentSyntax argument) 389private IEnumerable<TypeInferenceInfo> InferTypeInConstructorInitializer(ConstructorInitializerSyntax initializer, int index, ArgumentSyntax argument = null) 436private IEnumerable<TypeInferenceInfo> InferTypeInObjectCreationExpression(BaseObjectCreationExpressionSyntax creation, int index, ArgumentSyntax argumentOpt = null) 457PrimaryConstructorBaseTypeSyntax primaryConstructorBaseType, int index, ArgumentSyntax argumentOpt = null) 469InvocationExpressionSyntax invocation, int index, ArgumentSyntax argumentOpt = null) 564ElementAccessExpressionSyntax elementAccess, int index, ArgumentSyntax argumentOpt = null) 591private IEnumerable<TypeInferenceInfo> InferTypeInArgument(int index, IEnumerable<IMethodSymbol> methods, ArgumentSyntax argumentOpt, InvocationExpressionSyntax parentInvocationExpressionToTypeInfer) 737ArgumentSyntax argumentOpt) 1662ArgumentSyntax argumentSyntax => InferTypeInArgument(argumentSyntax), 2293SeparatedSyntaxList<ArgumentSyntax> arguments, 2303foreach (var arg in arguments)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\CSharpInitializeParameterService.cs (4)
62var left = (ArgumentSyntax)generator.Argument(generator.MemberAccessExpression(generator.ThisExpression(), generator.IdentifierName(fieldOrProperty.Name))); 63var right = (ArgumentSyntax)generator.Argument(generator.IdentifierName(parameter.Name));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
31public static Argument<ExpressionSyntax> GetArgument(ArgumentSyntax argument)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (11)
RefactoringHelpers\RefactoringHelpersTests.cs (10)
338await TestAsync<ArgumentSyntax>(testText, allowEmptyNodes: true); 357await TestAsync<ArgumentSyntax>(testText, allowEmptyNodes: true); 376await TestMissingAsync<ArgumentSyntax>(testText, allowEmptyNodes: false); 395await TestAsync<ArgumentSyntax>(testText, allowEmptyNodes: false); 1302await TestMissingAsync<ArgumentSyntax>(testText, n => n.Parent is TupleExpressionSyntax); 1321await TestAsync<ArgumentSyntax>(testText); 1336await TestAsync<ArgumentSyntax>(testText, n => n.Parent is TupleExpressionSyntax); 1744await TestAsync<ArgumentSyntax>(testText); 1764await TestMissingAsync<ArgumentSyntax>(testText); 1784await TestAsync<ArgumentSyntax>(testText, predicate: n => n.Parent is TupleExpressionSyntax);
SymbolKey\SymbolKeyTestBase.cs (1)
323foreach (var a in ctor.Initializer.ArgumentList.Arguments)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenTupleTest.cs (1)
17410var secondElement = nodes.OfType<TupleExpressionSyntax>().First().Arguments[1];
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (5)
Semantics\OutVarTests.cs (5)
916Assert.Null(model.GetDeclaredSymbol((ArgumentSyntax)x2Ref.Parent)); 1227if (((ArgumentSyntax)reference.Parent).RefOrOutKeyword.Kind() != SyntaxKind.OutKeyword) 1336if (((ArgumentSyntax)reference.Parent).RefOrOutKeyword.Kind() != SyntaxKind.None) 1413Assert.Null(model.GetDeclaredSymbol((ArgumentSyntax)x2Ref.Parent)); 1648Assert.Null(model.GetDeclaredSymbol((ArgumentSyntax)x2Ref.Parent));
Microsoft.CodeAnalysis.CSharp.Features (129)
ChangeSignature\CSharpChangeSignatureService.cs (6)
632var lastArgument = argumentList.Arguments.LastOrDefault(); 730private SeparatedSyntaxList<ArgumentSyntax> PermuteArgumentList( 732SeparatedSyntaxList<ArgumentSyntax> arguments, 744newArguments.Select(a => (ArgumentSyntax)(UnifiedArgumentSyntax)a), arguments); 896ArgumentSyntax a => (TArgumentSyntax)(SyntaxNode)a.WithNameColon(NameColon(name)), 907var listOfArguments = SeparatedList(newArguments.Skip(indexInExistingList).Select(a => ((ArgumentSyntax)(SyntaxNode)a).Expression), newArguments.GetSeparators().Skip(indexInExistingList));
ChangeSignature\UnifiedArgumentSyntax.cs (5)
23public static IUnifiedArgumentSyntax Create(ArgumentSyntax argument) 33return _argument is ArgumentSyntax argument 43return _argument is ArgumentSyntax argument 53return _argument is ArgumentSyntax argument 65return _argument is ArgumentSyntax argument
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
194(ArgumentSyntax)GenerateArgument(p, p.Name, shouldUseNamedArguments)).ToArray();
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
107if (identifierNode?.Parent is ArgumentSyntax argument)
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.cs (2)
77public override SyntaxNode? VisitArgument(ArgumentSyntax node) 90private bool ShouldAddTupleMemberName(ArgumentSyntax node, [NotNullWhen(true)] out IdentifierNameSyntax? identifier)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (5)
122result = IsFollowingTypeOrComma<ArgumentSyntax>( 141var argument = token.Parent.Parent as ArgumentSyntax // var is child of ArgumentSyntax, eg. Goo(out var $$ 142?? token.Parent.Parent?.Parent as ArgumentSyntax; // var is child of DeclarationExpression 622private static SyntaxNode? GetNodeDenotingTheTypeOfTupleArgument(ArgumentSyntax argumentSyntax)
Completion\KeywordRecommenders\ScopedKeywordRecommender.cs (1)
42return token.Parent is ArgumentSyntax;
Completion\Providers\OutVariableArgumentProvider.cs (1)
50var syntax = Argument(
ConvertAnonymousType\CSharpConvertAnonymousTypeToClassCodeRefactoringProvider.cs (3)
47private SeparatedSyntaxList<ArgumentSyntax> CreateArguments(SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> initializers) 48=> SyntaxFactory.SeparatedList<ArgumentSyntax>(CreateArguments(OmitTrailingComma(initializers.GetWithSeparators()))); 76private static ArgumentSyntax CreateArgument(AnonymousObjectMemberDeclaratorSyntax decl)
ConvertAnonymousType\CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (3)
38private static SeparatedSyntaxList<ArgumentSyntax> ConvertInitializers(SeparatedSyntaxList<AnonymousObjectMemberDeclaratorSyntax> declarators) 59return SeparatedList<ArgumentSyntax>(result); 62private static ArgumentSyntax ConvertDeclarator(AnonymousObjectMemberDeclaratorSyntax declarator)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
258ArgumentSyntax or
ConvertToInterpolatedString\CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
20ArgumentSyntax,
ConvertTupleToStruct\CSharpConvertTupleToStructCodeRefactoringProvider.cs (3)
24ArgumentSyntax, 35protected override ArgumentSyntax GetArgumentWithChangedName(ArgumentSyntax argument, string name)
Debugging\CSharpProximityExpressionsService.RelevantExpressionsCollector.cs (1)
117foreach (var a in t.Arguments)
Debugging\CSharpProximityExpressionsService_ExpressionTermCollector.cs (1)
392foreach (var arg in argumentList.Arguments)
EditAndContinue\SyntaxComparer.cs (1)
1330foreach (var argument in tupleExpression.Arguments)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
576using var _ = ArrayBuilder<ArgumentSyntax>.GetInstance(out var arguments);
GenerateType\CSharpGenerateTypeService.cs (4)
36AbstractGenerateTypeService<CSharpGenerateTypeService, SimpleNameSyntax, ObjectCreationExpressionSyntax, ExpressionSyntax, TypeDeclarationSyntax, ArgumentSyntax> 485protected override bool TryGetArgumentList(ObjectCreationExpressionSyntax objectCreationExpression, out IList<ArgumentSyntax> argumentList) 498SemanticModel semanticModel, IList<ArgumentSyntax> arguments, CancellationToken cancellationToken) 537protected override ITypeSymbol DetermineArgumentType(SemanticModel semanticModel, ArgumentSyntax argument, CancellationToken cancellationToken)
InlineHints\CSharpInlineParameterNameHintsService.cs (2)
67foreach (var argument in argumentList.Arguments) 73foreach (var argument in argumentList.Arguments)
IntroduceParameter\CSharpIntroduceParameterCodeRefactoringProvider.cs (2)
20ArgumentSyntax> 43protected override SyntaxNode UpdateArgumentListSyntax(SyntaxNode argumentList, SeparatedSyntaxList<ArgumentSyntax> arguments)
IntroduceVariable\CSharpIntroduceVariableService.Rewriter.cs (3)
59public override SyntaxNode? VisitArgument(ArgumentSyntax node) 61var newNode = (ArgumentSyntax)base.VisitArgument(node)!;
NameTupleElement\CSharpNameTupleElementCodeRefactoringProvider.cs (3)
18internal class CSharpNameTupleElementCodeRefactoringProvider : AbstractNameTupleElementCodeRefactoringProvider<ArgumentSyntax, TupleExpressionSyntax> 26protected override ArgumentSyntax WithName(ArgumentSyntax argument, string argumentName)
ReplaceConditionalWithStatements\CSharpReplaceConditionalWithStatementsCodeRefactoringProvider.cs (1)
24ArgumentSyntax,
SignatureHelp\LightweightOverloadResolution.cs (2)
23SeparatedSyntaxList<ArgumentSyntax> arguments) 110private bool IsCompatibleArgument(ArgumentSyntax argument, IParameterSymbol parameter)
SignatureHelp\SignatureHelpUtilities.cs (1)
107if (parenthesizedExpr.Parent is ArgumentSyntax)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (3)
81var argumentNode = (ArgumentSyntax)context.Node; 361ArgumentSyntax argumentNode,
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (2)
72foreach (var argument in codeBlock.DescendantNodesAndSelf().OfType<ArgumentSyntax>())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (11)
126using var _1 = ArrayBuilder<CollectionMatch<ArgumentSyntax>>.GetInstance(out var preMatchesInReverse); 127using var _2 = ArrayBuilder<CollectionMatch<ArgumentSyntax>>.GetInstance(out var postMatchesInReverse); 152ArrayBuilder<CollectionMatch<ArgumentSyntax>>? preMatchesInReverse, 153ArrayBuilder<CollectionMatch<ArgumentSyntax>>? postMatchesInReverse, 310postMatchesInReverse.Add(new CollectionMatch<ArgumentSyntax>( 320postMatchesInReverse.Add(new CollectionMatch<ArgumentSyntax>(Argument(expression), UseSpread: true)); 355ArrayBuilder<CollectionMatch<ArgumentSyntax>>? matchesInReverse, 356SeparatedSyntaxList<ArgumentSyntax> arguments, 379ArrayBuilder<CollectionMatch<ArgumentSyntax>>? matchesInReverse, 466ImmutableArray<CollectionMatch<ArgumentSyntax>> PreMatches, 467ImmutableArray<CollectionMatch<ArgumentSyntax>> PostMatches,
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (7)
447if (locallyScopedExpression.Parent is ArgumentSyntax argument) 568bool IsSafeUsageOfSpanAsArgument(ArgumentSyntax argument) 600bool AddRefLikeOutParameters(BaseArgumentListSyntax argumentList, ArgumentSyntax? argumentToSkip) 602foreach (var siblingArgument in argumentList.Arguments) 1007SemanticModel semanticModel, ArgumentSyntax argument, out bool unwrapArgument, out bool useSpread, CancellationToken cancellationToken) 1184public static SeparatedSyntaxList<ArgumentSyntax> GetArguments(ArgumentListSyntax argumentList, bool unwrapArgument) 1209: SeparatedList<ArgumentSyntax>(initializer.Expressions.GetWithSeparators().Select(
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (1)
39if (nameColon.Parent is not ArgumentSyntax argument)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (1)
167if (target.Syntax.DescendantNodesAndSelf().OfType<ArgumentSyntax>().Any(a => a.RefKindKeyword.Kind() is SyntaxKind.RefKeyword))
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
105else if (elements is [{ Syntax.Parent: ArgumentSyntax }, ..])
src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (3)
25foreach (var argument in arguments.Cast<ArgumentSyntax>()) 37=> ((ArgumentSyntax)syntaxNode).Expression;
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\ArgumentFixer.cs (6)
15private sealed class ArgumentFixer : Fixer<ArgumentSyntax, ArgumentListSyntax, SyntaxNode> 17protected override ExpressionSyntax GetExpressionOfArgument(ArgumentSyntax argument) 20protected override ArgumentSyntax GenerateNewArgument(ArgumentSyntax oldArgument, ITypeSymbol conversionType) 23protected override ArgumentListSyntax GenerateNewArgumentList(ArgumentListSyntax oldArgumentList, ArrayBuilder<ArgumentSyntax> newArguments) 26protected override SeparatedSyntaxList<ArgumentSyntax> GetArgumentsOfArgumentList(ArgumentListSyntax argumentList)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\CSharpAddExplicitCastCodeFixProvider.cs (2)
70if (spanNode.GetAncestorOrThis<ArgumentSyntax>() is ArgumentSyntax targetArgument
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (5)
24ArgumentSyntax, 50=> ((ArgumentSyntax)argumentNode).DetermineParameterType(semanticModel, cancellationToken); 52protected override Argument<ExpressionSyntax> GetArgument(ArgumentSyntax argument) 55protected override RegisterFixData<ArgumentSyntax>? TryGetLanguageSpecificFixInfo( 76return new RegisterFixData<ArgumentSyntax>(arguments, methodCandidates, isConstructorInitializer: true);
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
70private static ImmutableArray<Argument<ExpressionSyntax>> GetArguments(SeparatedSyntaxList<ArgumentSyntax> arguments)
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (2)
56foreach (var argument in _invocationExpression.ArgumentList.Arguments) 134private ITypeSymbol DetermineParameterType(ArgumentSyntax argument, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (2)
104symbolAndCapture => (ArgumentSyntax)generator.Argument( 111newArgumentsList = newArgumentsList.Insert(0, (ArgumentSyntax)generator.Argument(generator.ThisExpression()));
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (2)
60if (node.Parent is ArgumentSyntax) 213if (node.Parent is ArgumentSyntax argument && argument.Parent?.Parent is InvocationExpressionSyntax invocation)
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (2)
42var argumentSyntax = token.GetAncestor<ArgumentSyntax>(); 56ArgumentSyntax argumentSyntax,
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (7)
105SeparatedSyntaxList<ArgumentSyntax> arguments, 106ImmutableArray<CollectionMatch<ArgumentSyntax>> matches, 114var argument = arguments[i + index]; 141static async Task<SeparatedSyntaxList<ArgumentSyntax>> GetArgumentsAsync( 143ImmutableArray<CollectionMatch<ArgumentSyntax>> matches, 181return SeparatedList<ArgumentSyntax>(nodesAndTokens); 183void AddOriginallyFirstArgument(ArgumentSyntax firstArgument)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
168SeparatedList<ArgumentSyntax>(new SyntaxNodeOrTokenList(typeNode.Elements.GetWithSeparators().Select(ConvertTupleTypeElementComponent))),
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
164.Select(a => a.IsNode ? ((ArgumentSyntax)a.AsNode()!).Expression : a); 169var wrappedArgument = Argument(canUseImplicitArray 176return argumentList.WithArguments(SeparatedList<ArgumentSyntax>(finalArgumentsWithSeparators));
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
180using var _ = ArrayBuilder<ArgumentSyntax>.GetInstance(elements.Length, out var builder);
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
89var argument = Argument(rangeExpression).WithAdditionalAnnotations(Formatter.Annotation);
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
180return argumentList.WithArguments(SeparatedList<ArgumentSyntax>(arguments));
UseNamedArguments\CSharpUseNamedArgumentsCodeRefactoringProvider.cs (7)
61BaseAnalyzer<ArgumentSyntax, BaseArgumentListSyntax> 63protected override bool IsPositionalArgument(ArgumentSyntax node) 66protected override SeparatedSyntaxList<ArgumentSyntax> GetArguments(BaseArgumentListSyntax argumentList) 70BaseArgumentListSyntax argumentList, IEnumerable<ArgumentSyntax> namedArguments, IEnumerable<SyntaxToken> separators) 73protected override ArgumentSyntax WithName(ArgumentSyntax argument, string name) 76protected override ExpressionSyntax GetArgumentExpression(ArgumentSyntax argumentSyntax)
Wrapping\SeparatedSyntaxList\CSharpArgumentWrapper.cs (2)
17: AbstractCSharpSeparatedSyntaxListWrapper<BaseArgumentListSyntax, ArgumentSyntax> 44protected override SeparatedSyntaxList<ArgumentSyntax> GetListItems(BaseArgumentListSyntax listSyntax)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (11)
IOperation\IOperationTests_IArgument.cs (11)
3097VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3122VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3148VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3177VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3274VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3298VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3322VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3347VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3376VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3473VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics); 3612VerifyOperationTreeAndDiagnosticsForTest<ArgumentSyntax>(source, expectedOperationTree, expectedDiagnostics);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (13)
Semantics\DeconstructionTests.cs (10)
5997var argument = (ArgumentSyntax)mainCall.Parent; 6040var argument = (ArgumentSyntax)mainCall.Parent; 6080var argument = (ArgumentSyntax)mainCall.Parent; 6122var argument = (ArgumentSyntax)two.Parent; 6162var argument = (ArgumentSyntax)mainCall.Parent;
Semantics\FunctionPointerTests.cs (1)
203var parameter = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments.Single();
Semantics\NullableReferenceTypesTests.cs (2)
71874var arguments = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>(); 71921var arguments = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (18)
Compilation\GetSemanticInfoTests.cs (1)
5720var methodGroupSyntax = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>().Single().Expression;
Compilation\SemanticModelAPITests.cs (2)
1200var args = descendants.OfType<ArgumentSyntax>().Where(s => s.ToString() == "index").Select(s => s); 3751var expr = identifier.FirstAncestorOrSelf<ArgumentSyntax>().Parent.Parent;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (14)
4912var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4935var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4958var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4993var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5039var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5088var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5111var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
Symbols\Source\NullablePublicAPITests.cs (1)
5162var binaryRightArgument = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right.DescendantNodes().OfType<ArgumentSyntax>().Single().Expression;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (48)
Generated\Syntax.Test.xml.Generated.cs (8)
10293=> SyntaxFactory.TupleExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<ArgumentSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10371=> SyntaxFactory.ArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), new SeparatedSyntaxList<ArgumentSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 10374=> SyntaxFactory.BracketedArgumentList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), new SeparatedSyntaxList<ArgumentSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 10376private static ArgumentSyntax GenerateArgument() 11533var node = GenerateArgument(); 11538var newNode = node.WithNameColon(node.NameColon).WithRefKindKeyword(node.RefKindKeyword).WithExpression(node.Expression); 15373var oldNode = GenerateArgument(); 15389var oldNode = GenerateArgument();
Syntax\SyntaxFactoryTests.cs (2)
278var builder = new System.Collections.Generic.List<ArgumentSyntax>(); 283var list2 = SyntaxFactory.SeparatedList<ArgumentSyntax>(builder);
Syntax\SyntaxListTests.cs (1)
306Assert.Equal(expectedArgName, ((ArgumentSyntax)item).Expression.ToString());
Syntax\SyntaxNodeTests.cs (33)
690var argument = SyntaxFactory.Argument(name); 691var missingArgument = SyntaxFactory.Argument(missingName); 705var argumentList = SyntaxFactory.ArgumentList(SyntaxFactory.SeparatedList<ArgumentSyntax>(collectionExpression 2126var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 2127var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 2166var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 2167var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 2479var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2494var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2510var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2527var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2548var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2567var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2583var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2599var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2615var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2635var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2652var n = expr.DescendantTokens().Where(t => t.Text == "a").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2666var n = expr.DescendantTokens().Where(t => t.Text == "a").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2680var n = expr.DescendantTokens().Where(t => t.Text == "c").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault();
Syntax\SyntaxRewriterTests.cs (4)
379var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 380var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 398var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 399var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d"));
Microsoft.CodeAnalysis.CSharp.Workspaces (84)
CodeGeneration\CSharpSyntaxGenerator.cs (6)
966if (node is ArgumentSyntax arg && arg.Expression != null) 3156SyntaxFactory.BracketedArgumentList([.. arguments.Cast<ArgumentSyntax>()])); 3202SyntaxFactory.ArgumentList(openParen, (SeparatedSyntaxList<ArgumentSyntax>)arguments, closeParen), 3208private static SeparatedSyntaxList<ArgumentSyntax> CreateArguments(IEnumerable<SyntaxNode> arguments) 3211private static ArgumentSyntax AsArgument(SyntaxNode argOrExpression) 3212=> argOrExpression as ArgumentSyntax ?? SyntaxFactory.Argument((ExpressionSyntax)argOrExpression);
Recommendations\CSharpRecommendationServiceRunner.cs (1)
465foreach (var argument in primaryConstructorBase.ArgumentList.Arguments)
Simplification\CSharpSimplificationService.Expander.cs (7)
76private bool IsPassedToDelegateCreationExpression(ArgumentSyntax argument, ITypeSymbol type) 247public override SyntaxNode VisitArgument(ArgumentSyntax node) 251var newArgument = (ArgumentSyntax)base.VisitArgument(node); 294foreach (var argument in tuple.Arguments) 796foreach (var argument in invocationExpression.ArgumentList.Arguments) 1114var thisArgument = Argument(thisExpression).WithLeadingTrivia(SyntaxTriviaList.Empty);
Simplification\Reducers\AbstractCSharpReducer.AbstractReductionRewriter.cs (1)
90if (current is ExpressionSyntax or ArgumentSyntax)
Simplification\Reducers\CSharpExtensionMethodReducer.cs (1)
109var newArguments = SyntaxFactory.SeparatedList<ArgumentSyntax>(argumentList.Arguments.GetWithSeparators().AsEnumerable().Skip(2));
Simplification\Reducers\CSharpInferredMemberNameReducer.Rewriter.cs (5)
27private readonly Func<ArgumentSyntax, SemanticModel, SimplifierOptions, CancellationToken, ArgumentSyntax> s_simplifyTupleName; 29private ArgumentSyntax SimplifyTupleName(ArgumentSyntax node, SemanticModel semanticModel, SimplifierOptions options, CancellationToken cancellationToken) 51public override SyntaxNode VisitArgument(ArgumentSyntax node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
53var argument = tuple.Arguments[i];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (3)
14public static SyntaxTokenList GenerateParameterModifiers(this ArgumentSyntax argument) 24public static RefKind GetRefKind(this ArgumentSyntax? argument) 39this ArgumentSyntax argument,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (7)
198=> expression?.Parent is ArgumentSyntax { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) } argument && 214ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.RefKeyword }) 225=> expression?.Parent is ArgumentSyntax { RefKindKeyword: SyntaxToken(SyntaxKind.InKeyword) }; 385if (expression.Parent is ArgumentSyntax) 650=> expression is { Parent: ArgumentSyntax { Parent: ArgumentListSyntax { Parent: InvocationExpressionSyntax invocation } } } && 928ArgumentSyntax argument => GetTargetTypeForArgument(argument), 943ITypeSymbol? GetTargetTypeForArgument(ArgumentSyntax argument)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (5)
87nodeParent is ArgumentSyntax) 90if (nodeParent.GetRequiredParent().ChildNodes().OfType<ArgumentSyntax>().Any(a => a.Expression.IsKind(opposite))) 172if (nodeParent is ArgumentSyntax argument && argument.Expression == node) 618if (node.Parent is ArgumentSyntax argument) 653if (node.Parent is ArgumentSyntax argument)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
433if (topExpression?.Parent is ArgumentSyntax argument)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
256=> ((ArgumentSyntax)argument).DetermineParameter(semanticModel, allowUncertainCandidates, allowParams, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (5)
184=> node is ArgumentSyntax arg && arg.NameColon != null; 598=> ((ArgumentSyntax)node).Expression; 604=> ((ArgumentSyntax)node).GetRefKind(); 614return node is ArgumentSyntax argument && 1142=> (argument as ArgumentSyntax)?.NameColon?.Name.Identifier.ValueText ?? string.Empty;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (4)
13internal static bool CanSimplifyTupleElementName(ArgumentSyntax node, CSharpParseOptions parseOptions) 62private static bool RemovalCausesAmbiguity(SeparatedSyntaxList<ArgumentSyntax> arguments, ArgumentSyntax toRemove) 67foreach (var argument in arguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1463var argumentSyntax = argument?.Syntax as ArgumentSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (4)
34ArgumentSyntax, 588protected override ImmutableArray<ArgumentSyntax> GetArguments(ExpressionSyntax expression) 665protected override bool IsNamedArgument(ArgumentSyntax argument) 668protected override string GetNamedArgumentIdentifierValueText(ArgumentSyntax argument)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
217if (declarationExpression.Parent is not ArgumentSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ArgumentGenerator.cs (2)
13public static ArgumentSyntax GenerateArgument(SyntaxNode argument) 20return (ArgumentSyntax)argument;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (1)
25internal sealed class CSharpRefactoringHelpersService() : AbstractRefactoringHelpersService<ExpressionSyntax, ArgumentSyntax, ExpressionStatementSyntax>
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
675if (item.AsNode() is ArgumentSyntax node && node.NameColon != null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
1818token.Parent is ArgumentSyntax argument && 2875if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword })
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (1)
17this ArgumentSyntax argument,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (2)
54IEnumerable<ArgumentSyntax> arguments, 98this SemanticModel semanticModel, ArgumentSyntax argument, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (15)
139ArgumentSyntax argument => InferTypeInArgument(argument), 203ArgumentSyntax argument => InferTypeInArgument(argument, token), 268ArgumentSyntax argument, SyntaxToken? previousToken = null) 350return InferTypeInTupleExpression(tupleExpression, (ArgumentSyntax)argsAndCommas[commaIndex + 1]); 357TupleExpressionSyntax tupleExpression, ArgumentSyntax argument) 389private IEnumerable<TypeInferenceInfo> InferTypeInConstructorInitializer(ConstructorInitializerSyntax initializer, int index, ArgumentSyntax argument = null) 436private IEnumerable<TypeInferenceInfo> InferTypeInObjectCreationExpression(BaseObjectCreationExpressionSyntax creation, int index, ArgumentSyntax argumentOpt = null) 457PrimaryConstructorBaseTypeSyntax primaryConstructorBaseType, int index, ArgumentSyntax argumentOpt = null) 469InvocationExpressionSyntax invocation, int index, ArgumentSyntax argumentOpt = null) 564ElementAccessExpressionSyntax elementAccess, int index, ArgumentSyntax argumentOpt = null) 591private IEnumerable<TypeInferenceInfo> InferTypeInArgument(int index, IEnumerable<IMethodSymbol> methods, ArgumentSyntax argumentOpt, InvocationExpressionSyntax parentInvocationExpressionToTypeInfer) 737ArgumentSyntax argumentOpt) 1662ArgumentSyntax argumentSyntax => InferTypeInArgument(argumentSyntax), 2293SeparatedSyntaxList<ArgumentSyntax> arguments, 2303foreach (var arg in arguments)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\CSharpInitializeParameterService.cs (4)
62var left = (ArgumentSyntax)generator.Argument(generator.MemberAccessExpression(generator.ThisExpression(), generator.IdentifierName(fieldOrProperty.Name))); 63var right = (ArgumentSyntax)generator.Argument(generator.IdentifierName(parameter.Name));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
31public static Argument<ExpressionSyntax> GetArgument(ArgumentSyntax argument)
Microsoft.DotNet.CodeAnalysis (1)
Analyzers\AppContextDefaultsAnalyzer.cs (1)
73ArgumentSyntax args = call.ArgumentList.Arguments[1];
Microsoft.Interop.ComInterfaceGenerator (1)
ComMethodContext.cs (1)
147static ArgumentSyntax GenerateArgument(TypePositionInfo info)
Microsoft.Interop.JavaScript.JSImportGenerator (24)
JSExportCodeGenerator.cs (3)
152var signatureArgs = new List<ArgumentSyntax> 164private ArgumentSyntax CreateSignaturesSyntax() 199var arguments = new List<ArgumentSyntax>();
JSImportCodeGenerator.cs (2)
138(new ArgumentSyntax[] { 156private ArgumentSyntax CreateSignaturesSyntax()
Marshaling\FuncJSGenerator.cs (7)
39var source = TypeInfo.IsManagedReturnPosition 74private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source, JSFunctionTypeInfo info) 76List<ArgumentSyntax> arguments = [source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword))]; 95private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source, JSFunctionTypeInfo info) 97List<ArgumentSyntax> arguments = [source]; 116private static ArgumentSyntax ArgToJS(int i, TypeSyntax sourceType, MarshalerType marshalerType) => Argument(ParenthesizedLambdaExpression() 131private static ArgumentSyntax ArgToManaged(int i, TypeSyntax sourceType, MarshalerType marshalerType) => Argument(ParenthesizedLambdaExpression()
Marshaling\PrimitiveJSGenerator.cs (7)
32var source = TypeInfo.IsManagedReturnPosition 62protected virtual ArgumentSyntax ToManagedMethodRefOrOut(ArgumentSyntax argument) 67protected virtual ArgumentSyntax ToJSMethodRefOrOut(ArgumentSyntax argument) 72private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source) 79private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source)
Marshaling\TaskJSGenerator.cs (5)
45var source = TypeInfo.IsManagedReturnPosition 83private ExpressionStatementSyntax ToManagedMethodVoid(string target, ArgumentSyntax source) 90private ExpressionStatementSyntax ToJSMethodVoid(string target, ArgumentSyntax source) 97private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source, TypeSyntax sourceType) 120private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source, TypeSyntax sourceType)
Microsoft.Interop.SourceGeneration (18)
GeneratedStatements.cs (2)
102ArgumentSyntax argSyntax = marshaller.AsArgument(context); 136ArgumentSyntax argSyntax = marshaller.AsManagedArgument(context);
Marshalling\MarshallingGeneratorExtensions.cs (2)
139public static ArgumentSyntax AsArgument(this IBoundMarshallingGenerator generator, StubIdentifierContext context) 154public static ArgumentSyntax AsManagedArgument(this IBoundMarshallingGenerator generator, StubIdentifierContext context)
Marshalling\StatelessMarshallingStrategy.cs (7)
203ArgumentList(SeparatedList(new ArgumentSyntax[] 228ArgumentList(SeparatedList(new ArgumentSyntax[] 378ArgumentList(SeparatedList(new ArgumentSyntax[] 406ArgumentList(SeparatedList(new ArgumentSyntax[] 466ArgumentList(SeparatedList(new ArgumentSyntax[] 493ArgumentList(SeparatedList(new ArgumentSyntax[] 524ArgumentList(SeparatedList(new ArgumentSyntax[]
Utils\SyntaxFactoryExtensions.cs (7)
53ArgumentList(SeparatedList<ArgumentSyntax>())); 55public static InvocationExpressionSyntax MethodInvocation(ExpressionSyntax objectOrClass, SimpleNameSyntax methodName, params ArgumentSyntax[] arguments) 68public static ExpressionStatementSyntax MethodInvocationStatement(ExpressionSyntax objectOrClass, SimpleNameSyntax methodName, params ArgumentSyntax[] arguments) 71public static ArgumentSyntax RefArgument(ExpressionSyntax expression) 74public static ArgumentSyntax InArgument(ExpressionSyntax expression) 77public static ArgumentSyntax OutArgument(ExpressionSyntax expression) 92public static ElementAccessExpressionSyntax IndexExpression(ExpressionSyntax indexed, ArgumentSyntax argument)
Microsoft.Maui.Controls.BindingSourceGen (1)
PathParser.cs (1)
176 private Result<List<IPathPart>> CreateIndexAccess(ISymbol? elementAccessSymbol, ITypeSymbol? typeSymbol, SeparatedSyntaxList<ArgumentSyntax> argumentList, Location location)
Microsoft.ML.InternalCodeAnalyzer (9)
ContractsCheckAnalyzer.cs (5)
103private static ArgumentSyntax[] ParallelArgs( 107ArgumentSyntax[] args = new ArgumentSyntax[parameters.Length]; 111var arg = syntaxArgs[i]; 222var arg = args[i];
ContractsCheckNameofFixProvider.cs (4)
44var nameArg = root.FindToken(diagnosticSpan.Start).Parent.FirstAncestorOrSelf<ArgumentSyntax>(); 167private async Task<Document> StringReplaceAsync(Document document, string name, ArgumentSyntax nameArg, CancellationToken cancellationToken) 176private async Task<Document> ExpressionReplaceAsync(Document document, SyntaxNode exp, ArgumentSyntax nameArg, CancellationToken cancellationToken)
Microsoft.VisualStudio.LanguageServices.CSharp (4)
CodeModel\MethodXml\MethodXmlBuilder.cs (4)
400foreach (var argument in objectCreationExpression.ArgumentList.Arguments) 550foreach (var argument in invocationExpression.ArgumentList.Arguments) 589foreach (var argument in elementAccessExpression.ArgumentList.Arguments) 601private bool TryGenerateArgument(ArgumentSyntax argument)