Skip to content

Commit

Permalink
Reapply lost changes in SyntaxNodeExtensionsCSharp
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-strecker-sonarsource committed May 6, 2024
1 parent cb3f12a commit f71058e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ node switch
PointerTypeSyntax { ElementType: { } elementType } => GetIdentifier(elementType),
PredefinedTypeSyntax { Keyword: var keyword } => keyword,
QualifiedNameSyntax { Right.Identifier: var identifier } => identifier,
SimpleBaseTypeSyntax { Type: { } type } => GetIdentifier(type),
SimpleNameSyntax { Identifier: var identifier } => identifier,
TypeParameterConstraintClauseSyntax { Name.Identifier: var identifier } => identifier,
TypeParameterSyntax { Identifier: var identifier } => identifier,
Expand Down Expand Up @@ -375,13 +376,15 @@ static bool TakesExpressionTree(SymbolInfo info)
}
}

// based on Type="ArgumentListSyntax" in https://github.com/dotnet/roslyn/blob/main/src/Compilers/CSharp/Portable/Syntax/Syntax.xml
public static ArgumentListSyntax ArgumentList(this SyntaxNode node) =>
// based on Type="BaseArgumentListSyntax" in https://github.com/dotnet/roslyn/blob/main/src/Compilers/CSharp/Portable/Syntax/Syntax.xml
public static BaseArgumentListSyntax ArgumentList(this SyntaxNode node) =>
node switch
{
ObjectCreationExpressionSyntax creation => creation.ArgumentList,
InvocationExpressionSyntax invocation => invocation.ArgumentList,
ConstructorInitializerSyntax constructorInitializer => constructorInitializer.ArgumentList,
ElementAccessExpressionSyntax x => x.ArgumentList,
ElementBindingExpressionSyntax x => x.ArgumentList,
null => null,
_ when PrimaryConstructorBaseTypeSyntaxWrapper.IsInstance(node) => ((PrimaryConstructorBaseTypeSyntaxWrapper)node).ArgumentList,
_ when ImplicitObjectCreationExpressionSyntaxWrapper.IsInstance(node) => ((ImplicitObjectCreationExpressionSyntaxWrapper)node).ArgumentList,
Expand Down

0 comments on commit f71058e

Please sign in to comment.