10 types derived from TypeSyntax
Microsoft.CodeAnalysis.CSharp (10)
Syntax.xml.Syntax.Generated.cs (10)
15public abstract partial class NameSyntax : TypeSyntax 324public sealed partial class PredefinedTypeSyntax : TypeSyntax 364public sealed partial class ArrayTypeSyntax : TypeSyntax 478public sealed partial class PointerTypeSyntax : TypeSyntax 522public sealed partial class FunctionPointerTypeSyntax : TypeSyntax 797public sealed partial class NullableTypeSyntax : TypeSyntax 842public sealed partial class TupleTypeSyntax : TypeSyntax 951public sealed partial class OmittedTypeArgumentSyntax : TypeSyntax 991public sealed partial class RefTypeSyntax : TypeSyntax 1045public sealed partial class ScopedTypeSyntax : TypeSyntax
1585 references to TypeSyntax
Microsoft.AspNetCore.App.CodeFixes (4)
RouteParameterUnusedParameterFixer.cs (4)
22private static readonly TypeSyntax DefaultType = SyntaxFactory.ParseTypeName("string"); 81var resolvedType = CalculateTypeFromPolicy(routeParameterPolicy); 88var type = resolvedType.WithAdditionalAnnotations(new SyntaxAnnotation("CodeAction_Navigation")); 124private static TypeSyntax CalculateTypeFromPolicy(string? routeParameterPolicy)
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
62TypeSyntax type = node.Type;
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
62TypeSyntax type = node.Type;
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (2)
HubClientProxyGenerator.Parser.cs (1)
250var argType = gns.TypeArgumentList.Arguments[0];
HubServerProxyGenerator.Parser.cs (1)
233var proxyType = ((GenericNameSyntax)memberAccess.Name).TypeArgumentList.Arguments[0];
Microsoft.CodeAnalysis.CSharp (536)
Binder\Binder.WithQueryLambdaParametersBinder.cs (1)
99var result = BindMemberOfType(node, node, name, 0, invoked: false, indexed: false, receiver, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), lookupResult, BoundMethodGroupFlags.None, diagnostics);
Binder\Binder_Await.cs (1)
621var qualified = BindInstanceMemberAccess(node, node, receiver, name, 0, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), invoked: false, indexed: false, diagnostics);
Binder\Binder_Constraints.cs (1)
255var typeSyntax = typeConstraintSyntax.Type;
Binder\Binder_Conversions.cs (1)
1303typeArgumentsSyntax: default(SeparatedSyntaxList<TypeSyntax>),
Binder\Binder_Crefs.cs (4)
83private NamespaceOrTypeSymbol BindNamespaceOrTypeSymbolInCref(TypeSyntax syntax) 1085SeparatedSyntaxList<TypeSyntax> typeArgumentSyntaxes = typeArgumentListSyntax.Arguments; 1097TypeSyntax typeArgumentSyntax = typeArgumentSyntaxes[i]; 1153private TypeSymbol BindCrefParameterOrReturnType(TypeSyntax typeSyntax, MemberCrefSyntax memberCrefSyntax, BindingDiagnosticBag diagnostics)
Binder\Binder_Deconstruct.cs (4)
654typeArgumentsSyntax: default(SeparatedSyntaxList<TypeSyntax>), 821TypeSyntax typeSyntax = declExpr.Type; 880TypeSyntax typeSyntax = declExpr.Type; 931TypeSyntax typeSyntax = declExpr.Type;
Binder\Binder_Expressions.cs (15)
1649SeparatedSyntaxList<TypeSyntax> typeArgumentList = node.Kind() == SyntaxKind.GenericName 1651: default(SeparatedSyntaxList<TypeSyntax>); 3168TypeSyntax typeSyntax = declarationExpression.Type; 3210TypeSyntax typeSyntax = declarationExpression.Type; 4519TypeSyntax typeSyntax = node.Type; 4534var elementTypeSyntax = arrayTypeSyntax.ElementType; 7619SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? 7621default(SeparatedSyntaxList<TypeSyntax>); 7668/// <see cref="MakeQueryInvocation(CSharpSyntaxNode, BoundExpression, bool, string, SeparatedSyntaxList{TypeSyntax}, ImmutableArray{TypeWithAnnotations}, ImmutableArray{BoundExpression}, BindingDiagnosticBag, string?)"/>. 7742var typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? ((GenericNameSyntax)right).TypeArgumentList.Arguments : default(SeparatedSyntaxList<TypeSyntax>); 7838SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, 7912SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, 8094SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, 8165SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, BindingDiagnosticBag diagnostics) 8427SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax,
Binder\Binder_Invocation.cs (2)
84SeparatedSyntaxList<TypeSyntax> typeArgsSyntax = default(SeparatedSyntaxList<TypeSyntax>),
Binder\Binder_Lambda.cs (1)
292private (RefKind, ImmutableArray<CustomModifier> refCustomModifiers, TypeWithAnnotations) BindExplicitLambdaReturnType(TypeSyntax syntax, BindingDiagnosticBag diagnostics)
Binder\Binder_Patterns.cs (6)
855TypeSyntax typeSyntax = node.Type; 864TypeSyntax typeSyntax, 881TypeSyntax? typeSyntax, 939TypeSyntax? typeSyntax, 984TypeSyntax? typeSyntax = node.Type; 1567typeArgumentsSyntax: default(SeparatedSyntaxList<TypeSyntax>),
Binder\Binder_Query.cs (6)
853private UnboundLambda MakeQueryUnboundLambdaWithCast(RangeVariableMap qvm, RangeVariableSymbol parameter, ExpressionSyntax expression, TypeSyntax castTypeSyntax, TypeWithAnnotations castType, bool withDependencies) 891return MakeQueryInvocation(node, receiver, receiverIsCheckedForRValue, methodName, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), ImmutableArray.Create(arg), diagnostics 904return MakeQueryInvocation(node, receiver, receiverIsCheckedForRValue, methodName, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), args, diagnostics 911protected BoundCall MakeQueryInvocation(CSharpSyntaxNode node, BoundExpression receiver, bool receiverIsCheckedForRValue, string methodName, TypeSyntax typeArgSyntax, TypeWithAnnotations typeArg, BindingDiagnosticBag diagnostics 917return MakeQueryInvocation(node, receiver, receiverIsCheckedForRValue, methodName, new SeparatedSyntaxList<TypeSyntax>(new SyntaxNodeOrTokenList(typeArgSyntax, 0)), ImmutableArray.Create(typeArg), ImmutableArray<BoundExpression>.Empty, diagnostics 924protected BoundCall MakeQueryInvocation(CSharpSyntaxNode node, BoundExpression receiver, bool receiverIsCheckedForRValue, string methodName, SeparatedSyntaxList<TypeSyntax> typeArgsSyntax, ImmutableArray<TypeWithAnnotations> typeArgs, ImmutableArray<BoundExpression> args, BindingDiagnosticBag diagnostics
Binder\Binder_Statements.cs (6)
709var typeSyntax = node.Declaration.Type; 786private TypeWithAnnotations BindVariableTypeWithAnnotations(CSharpSyntaxNode declarationNode, BindingDiagnosticBag diagnostics, TypeSyntax typeSyntax, ref bool isConst, out bool isVar, out AliasSymbol alias) 953TypeSyntax typeSyntax, 979TypeSyntax typeSyntax, 1196private SourceLocalSymbol LocateDeclaredVariableSymbol(VariableDeclaratorSyntax declarator, TypeSyntax typeSyntax, LocalDeclarationKind outerKind, BindingDiagnosticBag diagnostics) 2842var typeSyntax = nodeOpt.Type;
Binder\Binder_Symbols.cs (16)
38internal TypeWithAnnotations BindTypeOrVarKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out bool isVar) 58private TypeWithAnnotations BindTypeOrConstraintKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out ConstraintContextualKeyword keyword) 79internal TypeWithAnnotations BindTypeOrVarKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out bool isVar, out AliasSymbol alias) 108private NamespaceOrTypeOrAliasSymbolWithAnnotations BindTypeOrAliasOrVarKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out bool isVar) 135private NamespaceOrTypeOrAliasSymbolWithAnnotations BindTypeOrAliasOrConstraintKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out ConstraintContextualKeyword keyword) 185/// PREREQUISITE: syntax should be checked to match the keyword, like <see cref="TypeSyntax.IsVar"/> or <see cref="TypeSyntax.IsUnmanaged"/>. 478return BindTypeArgument((TypeSyntax)syntax, diagnostics, basesBeingResolved); 551TypeSyntax typeArgumentSyntax = nullableSyntax.ElementType; 1213SeparatedSyntaxList<TypeSyntax> typeArguments = node.TypeArgumentList.Arguments; 1346private ImmutableArray<TypeWithAnnotations> BindTypeArguments(SeparatedSyntaxList<TypeSyntax> typeArguments, BindingDiagnosticBag diagnostics, ConsList<TypeSymbol> basesBeingResolved = null) 1350foreach (var argSyntax in typeArguments) 1358private TypeWithAnnotations BindTypeArgument(TypeSyntax typeArgument, BindingDiagnosticBag diagnostics, ConsList<TypeSymbol> basesBeingResolved = null) 1381private NamedTypeSymbol ConstructNamedTypeUnlessTypeArgumentOmitted(SyntaxNode typeSyntax, NamedTypeSymbol type, SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, ImmutableArray<TypeWithAnnotations> typeArguments, BindingDiagnosticBag diagnostics) 1426SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, 1620SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax,
Binder\ExpressionVariableFinder.cs (7)
287protected abstract TFieldOrLocalSymbol MakePatternVariable(TypeSyntax type, SingleVariableDesignationSyntax designation, SyntaxNode nodeToBind); 497TypeSyntax closestTypeSyntax, 544TypeSyntax closestTypeSyntax, 599protected override LocalSymbol? MakePatternVariable(TypeSyntax type, SingleVariableDesignationSyntax designation, SyntaxNode nodeToBind) 650TypeSyntax closestTypeSyntax, 714protected override Symbol MakePatternVariable(TypeSyntax type, SingleVariableDesignationSyntax designation, SyntaxNode nodeToBind) 735TypeSyntax closestTypeSyntax,
Binder\ForEachLoopBinder.cs (2)
139TypeSyntax closestTypeSyntax, 290TypeSyntax typeSyntax = node.Type;
Binder\ForLoopBinder.cs (1)
75var type = _syntax.Declaration.Type.SkipScoped(out _);
Binder\LocalBinderFactory.cs (1)
54private void VisitRankSpecifiers(TypeSyntax type, Binder enclosing)
Binder\OpenTypeVisitor.cs (2)
42SeparatedSyntaxList<TypeSyntax> typeArguments = node.TypeArgumentList.Arguments; 51foreach (TypeSyntax arg in typeArguments)
Binder\WithCrefTypeParametersBinder.cs (2)
79private void AddTypeParameters(TypeSyntax typeSyntax, MultiDictionary<string, TypeParameterSymbol> map) 122private static void AddTypeParameters(SeparatedSyntaxList<TypeSyntax> typeArguments, MultiDictionary<string, TypeParameterSymbol> map)
BoundTree\VariablePendingInference.cs (1)
70(typeOrDesignationSyntax is TypeSyntax typeSyntax ? typeSyntax.SkipScoped(out _).SkipRef() : typeOrDesignationSyntax).Location);
Compilation\CSharpSemanticModel.cs (8)
164/// then the provided expression should be a <see cref="TypeSyntax"/>.</param> 211if (!(expression is TypeSyntax)) 257Debug.Assert(bindingOption != SpeculativeBindingOption.BindAsTypeOrNamespace || expression is TypeSyntax); 310else if (expression is TypeSyntax typeSyntax) 546if (((TypeSyntax)expression).IsVar) 976if (((TypeSyntax)expression).IsVar) 2566public bool TryGetSpeculativeSemanticModel(int position, TypeSyntax type, out SemanticModel speculativeModel, SpeculativeBindingOption bindingOption = SpeculativeBindingOption.BindAsExpression) 2574internal abstract bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, TypeSyntax type, SpeculativeBindingOption bindingOption, out PublicSemanticModel speculativeModel);
Compilation\MemberSemanticModel.cs (2)
170internal sealed override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, TypeSyntax type, SpeculativeBindingOption bindingOption, out PublicSemanticModel speculativeModel) 1549Debug.Assert((manager is null && (!IsNullableAnalysisEnabled() || syntax != Root || syntax is TypeSyntax ||
Compilation\MemberSemanticModel.SpeculativeMemberSemanticModel.cs (2)
29TypeSyntax root, 51Debug.Assert(boundRoot.Syntax is TypeSyntax);
Compilation\SpeculativeSemanticModelWithMemberModel.cs (2)
91TypeSyntax type, 565internal sealed override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, TypeSyntax type, SpeculativeBindingOption bindingOption, out PublicSemanticModel speculativeModel)
Compilation\SpeculativeSyntaxTreeSemanticModel.cs (2)
27public static SpeculativeSyntaxTreeSemanticModel Create(SyntaxTreeSemanticModel parentSemanticModel, TypeSyntax root, Binder rootBinder, int position, SpeculativeBindingOption bindingOption) 41Debug.Assert(root is TypeSyntax || root is CrefSyntax);
Compilation\SyntaxTreeSemanticModel.cs (5)
339var type = node as TypeSyntax; 501private ConsList<TypeSymbol> GetBasesBeingResolved(TypeSyntax expression) 505for (; expression != null && expression.Parent != null; expression = expression.Parent as TypeSyntax) 594internal sealed override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, TypeSyntax type, SpeculativeBindingOption bindingOption, out PublicSemanticModel speculativeModel)
CSharpExtensions.cs (1)
1174public static bool TryGetSpeculativeSemanticModel([NotNullWhen(true)] this SemanticModel? semanticModel, int position, TypeSyntax type, [NotNullWhen(true)] out SemanticModel? speculativeModel, SpeculativeBindingOption bindingOption = SpeculativeBindingOption.BindAsExpression)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
623private static TextSpan SkipAttributes(SyntaxNode syntax, SyntaxList<AttributeListSyntax> attributes, SyntaxTokenList modifiers, SyntaxToken keyword, TypeSyntax? type)
Symbols\AliasSymbol.cs (1)
384var syntax = usingDirective.NamespaceOrType;
Symbols\ConstraintsHelper.cs (1)
680SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, // may be omitted in synthesized invocations
Symbols\Source\GlobalExpressionVariable.cs (6)
32TypeSyntax typeSyntax, 45TypeSyntax typeSyntax, 61protected override TypeSyntax TypeSyntax => (TypeSyntax)_typeSyntaxOpt?.GetSyntax(); 80var typeSyntax = TypeSyntax; 171TypeSyntax typeSyntax,
Symbols\Source\LocalFunctionSymbol.cs (1)
257TypeSyntax returnTypeSyntax = Syntax.ReturnType;
Symbols\Source\SourceDelegateMethodSymbol.cs (1)
53TypeSyntax returnTypeSyntax = syntax.ReturnType;
Symbols\Source\SourceEventSymbol.cs (1)
814protected TypeWithAnnotations BindEventType(Binder binder, TypeSyntax typeSyntax, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceLocalSymbol.cs (11)
32private readonly TypeSyntax _typeSyntax; 77TypeSyntax typeSyntax, 142TypeSyntax typeSyntax, 170TypeSyntax closestTypeSyntax, 192TypeSyntax typeSyntax, 239TypeSyntax typeSyntax, 349TypeSyntax typeSyntax = _typeSyntax.SkipScoped(out _).SkipRef(); 625TypeSyntax typeSyntax, 724TypeSyntax typeSyntax, 759TypeSyntax typeSyntax, 806TypeSyntax? typeSyntax,
Symbols\Source\SourceMemberFieldSymbol.cs (4)
44protected abstract TypeSyntax TypeSyntax { get; } 388protected sealed override TypeSyntax TypeSyntax 458var typeSyntax = fieldSyntax.Declaration.Type; 499var typeOnly = typeSyntax.SkipScoped(out _).SkipRefInField(out refKind);
Symbols\Source\SourceMethodSymbol.cs (1)
34protected static void ReportBadRefToken(TypeSyntax returnTypeSyntax, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
1540var returnTypeSyntax = this.SyntaxNode switch
Symbols\Source\SourceNamedTypeSymbol.cs (1)
62TypeSyntax t = baseTypeSyntax.Type;
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (2)
225var b = baseTypeSyntax.Type; 467var typeSyntax = baseTypeSyntax.Type;
Symbols\Source\SourceNamedTypeSymbol_Enum.cs (1)
59var typeSyntax = types[0].Type;
Symbols\Source\SourceOrdinaryMethodSymbol.cs (1)
134var returnTypeSyntax = syntax.ReturnType;
Symbols\Source\SourcePropertySymbol.cs (2)
172private TypeSyntax GetTypeSyntax(SyntaxNode syntax) => ((BasePropertyDeclarationSyntax)syntax).Type; 573var typeSyntax = GetTypeSyntax(syntax);
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (1)
310protected (TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymbol> Parameters) MakeParametersAndBindReturnType(BaseMethodDeclarationSyntax declarationSyntax, TypeSyntax returnTypeSyntax, BindingDiagnosticBag diagnostics)
Syntax.xml.Main.Generated.cs (144)
1525=> node.Update((TypeSyntax?)Visit(node.ElementType) ?? throw new ArgumentNullException("elementType"), VisitList(node.RankSpecifiers)); 1531=> node.Update((TypeSyntax?)Visit(node.ElementType) ?? throw new ArgumentNullException("elementType"), VisitToken(node.AsteriskToken)); 1549=> node.Update((TypeSyntax?)Visit(node.ElementType) ?? throw new ArgumentNullException("elementType"), VisitToken(node.QuestionToken)); 1555=> node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier)); 1561=> node.Update(VisitToken(node.RefKeyword), VisitToken(node.ReadOnlyKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); 1564=> node.Update(VisitToken(node.ScopedKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); 1627=> node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.Comma), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); 1633=> node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); 1636=> node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); 1639=> node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); 1663=> node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (VariableDesignationSyntax?)Visit(node.Designation) ?? throw new ArgumentNullException("designation")); 1666=> node.Update(VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); 1678=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitToken(node.ArrowToken), (BlockSyntax?)Visit(node.Block), (ExpressionSyntax?)Visit(node.ExpressionBody)); 1687=> node.Update(VisitToken(node.NewKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ArgumentListSyntax?)Visit(node.ArgumentList), (InitializerExpressionSyntax?)Visit(node.Initializer)); 1705=> node.Update(VisitToken(node.StackAllocKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (InitializerExpressionSyntax?)Visit(node.Initializer)); 1726=> node.Update(VisitToken(node.FromKeyword), (TypeSyntax?)Visit(node.Type), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); 1732=> node.Update(VisitToken(node.JoinKeyword), (TypeSyntax?)Visit(node.Type), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.InExpression) ?? throw new ArgumentNullException("inExpression"), VisitToken(node.OnKeyword), (ExpressionSyntax?)Visit(node.LeftExpression) ?? throw new ArgumentNullException("leftExpression"), VisitToken(node.EqualsKeyword), (ExpressionSyntax?)Visit(node.RightExpression) ?? throw new ArgumentNullException("rightExpression"), (JoinIntoClauseSyntax?)Visit(node.Into)); 1774=> node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (VariableDesignationSyntax?)Visit(node.Designation) ?? throw new ArgumentNullException("designation")); 1780=> node.Update((TypeSyntax?)Visit(node.Type), (PositionalPatternClauseSyntax?)Visit(node.PositionalPatternClause), (PropertyPatternClauseSyntax?)Visit(node.PropertyPatternClause), (VariableDesignationSyntax?)Visit(node.Designation)); 1801=> node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); 1834=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); 1840=> node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitList(node.Variables)); 1894=> node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.ForEachKeyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); 1948=> node.Update(VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier), VisitToken(node.CloseParenToken)); 1963=> node.Update(VisitToken(node.GlobalKeyword), VisitToken(node.UsingKeyword), VisitToken(node.StaticKeyword), VisitToken(node.UnsafeKeyword), (NameEqualsSyntax?)Visit(node.Alias), (TypeSyntax?)Visit(node.NamespaceOrType) ?? throw new ArgumentNullException("namespaceOrType"), VisitToken(node.SemicolonToken)); 2011=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.DelegateKeyword), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), VisitToken(node.SemicolonToken)); 2023=> node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); 2026=> node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); 2038=> node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); 2059=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); 2062=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), VisitToken(node.OperatorToken), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); 2065=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.ImplicitOrExplicitKeyword), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); 2077=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (AccessorListSyntax?)Visit(node.AccessorList), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), (EqualsValueClauseSyntax?)Visit(node.Initializer), VisitToken(node.SemicolonToken)); 2083=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.EventKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (AccessorListSyntax?)Visit(node.AccessorList), VisitToken(node.SemicolonToken)); 2086=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.ThisKeyword), (BracketedParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (AccessorListSyntax?)Visit(node.AccessorList), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); 2101=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type), VisitToken(node.Identifier), (EqualsValueClauseSyntax?)Visit(node.Default)); 2104=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); 2107=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type)); 2116=> node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); 2119=> node.Update((TypeSyntax?)Visit(node.Container) ?? throw new ArgumentNullException("container"), VisitToken(node.DotToken), (MemberCrefSyntax?)Visit(node.Member) ?? throw new ArgumentNullException("member")); 2122=> node.Update((TypeSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), (CrefParameterListSyntax?)Visit(node.Parameters)); 2134=> node.Update(VisitToken(node.ImplicitOrExplicitKeyword), VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (CrefParameterListSyntax?)Visit(node.Parameters)); 2143=> node.Update(VisitToken(node.RefKindKeyword), VisitToken(node.ReadOnlyKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); 2293public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, SeparatedSyntaxList<TypeSyntax> arguments, SyntaxToken greaterThanToken) 2301public static TypeArgumentListSyntax TypeArgumentList(SeparatedSyntaxList<TypeSyntax> arguments = default) 2348public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, SyntaxList<ArrayRankSpecifierSyntax> rankSpecifiers) 2355public static ArrayTypeSyntax ArrayType(TypeSyntax elementType) 2371public static PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) 2379public static PointerTypeSyntax PointerType(TypeSyntax elementType) 2447public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) 2455public static NullableTypeSyntax NullableType(TypeSyntax elementType) 2471public static TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken identifier) 2484public static TupleElementSyntax TupleElement(TypeSyntax type) 2499public static RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) 2513public static RefTypeSyntax RefType(TypeSyntax type) 2517public static ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) 2525public static ScopedTypeSyntax ScopedType(TypeSyntax type) 3015public static RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) 3027public static RefValueExpressionSyntax RefValueExpression(ExpressionSyntax expression, TypeSyntax type) 3064public static DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3074public static DefaultExpressionSyntax DefaultExpression(TypeSyntax type) 3078public static TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3088public static TypeOfExpressionSyntax TypeOfExpression(TypeSyntax type) 3092public static SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3102public static SizeOfExpressionSyntax SizeOfExpression(TypeSyntax type) 3189public static DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) 3197public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) 3207public static CastExpressionSyntax CastExpression(TypeSyntax type, ExpressionSyntax expression) 3239public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) 3247public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, BlockSyntax? block, ExpressionSyntax? expressionBody) 3292public static ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) 3300public static ObjectCreationExpressionSyntax ObjectCreationExpression(TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) 3304public static ObjectCreationExpressionSyntax ObjectCreationExpression(TypeSyntax type) 3379public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) 3387public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(TypeSyntax type, InitializerExpressionSyntax? initializer) 3391public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(TypeSyntax type) 3459public static FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) 3469public static FromClauseSyntax FromClause(TypeSyntax? type, SyntaxToken identifier, ExpressionSyntax expression) 3499public static JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) 3513public static JoinClauseSyntax JoinClause(TypeSyntax? type, SyntaxToken identifier, ExpressionSyntax inExpression, ExpressionSyntax leftExpression, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) 3722public static DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) 3742public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) 3824public static TypePatternSyntax TypePattern(TypeSyntax type) 3977public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 3992public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) 3996public static LocalFunctionStatementSyntax LocalFunctionStatement(TypeSyntax returnType, SyntaxToken identifier) 4000public static LocalFunctionStatementSyntax LocalFunctionStatement(TypeSyntax returnType, string identifier) 4032public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, SeparatedSyntaxList<VariableDeclaratorSyntax> variables) 4039public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type) 4350public static ForEachStatementSyntax ForEachStatement(SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 4370public static ForEachStatementSyntax ForEachStatement(SyntaxList<AttributeListSyntax> attributeLists, TypeSyntax type, SyntaxToken identifier, ExpressionSyntax expression, StatementSyntax statement) 4374public static ForEachStatementSyntax ForEachStatement(TypeSyntax type, SyntaxToken identifier, ExpressionSyntax expression, StatementSyntax statement) 4378public static ForEachStatementSyntax ForEachStatement(TypeSyntax type, string identifier, ExpressionSyntax expression, StatementSyntax statement) 4700public static CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) 4715public static CatchDeclarationSyntax CatchDeclaration(TypeSyntax type, SyntaxToken identifier) 4719public static CatchDeclarationSyntax CatchDeclaration(TypeSyntax type) 4782public static UsingDirectiveSyntax UsingDirective(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) 4809public static UsingDirectiveSyntax UsingDirective(NameEqualsSyntax? alias, TypeSyntax namespaceOrType) 4813public static UsingDirectiveSyntax UsingDirective(TypeSyntax namespaceOrType) 5131public static DelegateDeclarationSyntax DelegateDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken semicolonToken) 5142public static DelegateDeclarationSyntax DelegateDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses) 5146public static DelegateDeclarationSyntax DelegateDeclaration(TypeSyntax returnType, SyntaxToken identifier) 5150public static DelegateDeclarationSyntax DelegateDeclaration(TypeSyntax returnType, string identifier) 5213public static SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) 5220public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) 5228public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type) 5302public static TypeConstraintSyntax TypeConstraint(TypeSyntax type) 5388public static MethodDeclarationSyntax MethodDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 5403public static MethodDeclarationSyntax MethodDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) 5407public static MethodDeclarationSyntax MethodDeclaration(TypeSyntax returnType, SyntaxToken identifier) 5411public static MethodDeclarationSyntax MethodDeclaration(TypeSyntax returnType, string identifier) 5415public static OperatorDeclarationSyntax OperatorDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 5475public static OperatorDeclarationSyntax OperatorDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) 5479public static OperatorDeclarationSyntax OperatorDeclaration(TypeSyntax returnType, SyntaxToken operatorToken) 5483public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 5510public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) 5514public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(SyntaxToken implicitOrExplicitKeyword, TypeSyntax type) 5603public static PropertyDeclarationSyntax PropertyDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) 5617public static PropertyDeclarationSyntax PropertyDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer) 5621public static PropertyDeclarationSyntax PropertyDeclaration(TypeSyntax type, SyntaxToken identifier) 5625public static PropertyDeclarationSyntax PropertyDeclaration(TypeSyntax type, string identifier) 5641public static EventDeclarationSyntax EventDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) 5656public static EventDeclarationSyntax EventDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList) 5660public static EventDeclarationSyntax EventDeclaration(TypeSyntax type, SyntaxToken identifier) 5664public static EventDeclarationSyntax EventDeclaration(TypeSyntax type, string identifier) 5668public static IndexerDeclarationSyntax IndexerDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 5683public static IndexerDeclarationSyntax IndexerDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody) 5687public static IndexerDeclarationSyntax IndexerDeclaration(TypeSyntax type) 5779public static ParameterSyntax Parameter(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) 5792public static FunctionPointerParameterSyntax FunctionPointerParameter(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type) 5799public static FunctionPointerParameterSyntax FunctionPointerParameter(TypeSyntax type) 5803public static IncompleteMemberSyntax IncompleteMember(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) 5810public static IncompleteMemberSyntax IncompleteMember(TypeSyntax? type = default) 5842public static TypeCrefSyntax TypeCref(TypeSyntax type) 5849public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) 5858public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, MemberCrefSyntax member) 5862public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) 5869public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name) 5961public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) 5981public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) 5985public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, TypeSyntax type) 6013public static CrefParameterSyntax CrefParameter(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) 6034public static CrefParameterSyntax CrefParameter(SyntaxToken refKindKeyword, TypeSyntax type) 6038public static CrefParameterSyntax CrefParameter(TypeSyntax type)
Syntax.xml.Syntax.Generated.cs (195)
185public GenericNameSyntax AddTypeArgumentListArguments(params TypeSyntax[] items) => WithTypeArgumentList(this.TypeArgumentList.WithArguments(this.TypeArgumentList.Arguments.AddRange(items))); 208public SeparatedSyntaxList<TypeSyntax> Arguments 213return red != null ? new SeparatedSyntaxList<TypeSyntax>(red, GetChildIndex(1)) : default; 227public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList<TypeSyntax> arguments, SyntaxToken greaterThanToken) 240public TypeArgumentListSyntax WithArguments(SeparatedSyntaxList<TypeSyntax> arguments) => Update(this.LessThanToken, arguments, this.GreaterThanToken); 243public TypeArgumentListSyntax AddArguments(params TypeSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); 366private TypeSyntax? elementType; 375public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; 399public ArrayTypeSyntax Update(TypeSyntax elementType, SyntaxList<ArrayRankSpecifierSyntax> rankSpecifiers) 411public ArrayTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.RankSpecifiers); 480private TypeSyntax? elementType; 488public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; 500public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) 512public PointerTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.AsteriskToken); 799private TypeSyntax? elementType; 807public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; 819public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) 831public NullableTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.QuestionToken); 901private TypeSyntax? type; 909public TypeSyntax Type => GetRedAtZero(ref this.type)!; 928public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) 940public TupleElementSyntax WithType(TypeSyntax type) => Update(type, this.Identifier); 993private TypeSyntax? type; 1012public TypeSyntax Type => GetRed(ref this.type, 2)!; 1021public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) 1035public RefTypeSyntax WithType(TypeSyntax type) => Update(this.RefKeyword, this.ReadOnlyKeyword, type); 1047private TypeSyntax? type; 1056public TypeSyntax Type => GetRed(ref this.type, 1)!; 1065public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) 1078public ScopedTypeSyntax WithType(TypeSyntax type) => Update(this.ScopedKeyword, type); 2191private TypeSyntax? type; 2211public TypeSyntax Type => GetRed(ref this.type, 4)!; 2235public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) 2251public RefValueExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, type, this.CloseParenToken); 2318private TypeSyntax? type; 2332public TypeSyntax Type => GetRed(ref this.type, 2)!; 2344public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 2358public DefaultExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); 2371private TypeSyntax? type; 2385public TypeSyntax Type => GetRed(ref this.type, 2)!; 2397public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 2411public TypeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); 2424private TypeSyntax? type; 2438public TypeSyntax Type => GetRed(ref this.type, 2)!; 2450public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 2464public SizeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); 2909private TypeSyntax? type; 2917public TypeSyntax Type => GetRedAtZero(ref this.type)!; 2941public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) 2953public DeclarationExpressionSyntax WithType(TypeSyntax type) => Update(type, this.Designation); 2966private TypeSyntax? type; 2978public TypeSyntax Type => GetRed(ref this.type, 1)!; 3005public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) 3018public CastExpressionSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.CloseParenToken, this.Expression); 3359private TypeSyntax? returnType; 3380public TypeSyntax? ReturnType => GetRed(ref this.returnType, 2); 3425public ParenthesizedLambdaExpressionSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) 3441public ParenthesizedLambdaExpressionSyntax WithReturnType(TypeSyntax? returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); 3634private TypeSyntax? type; 3647public TypeSyntax Type => GetRed(ref this.type, 1)!; 3676public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) 3690public ObjectCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.NewKeyword, type, this.ArgumentList, this.Initializer); 4024private TypeSyntax? type; 4036public TypeSyntax Type => GetRed(ref this.type, 1)!; 4060public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) 4073public StackAllocArrayCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.StackAllocKeyword, type, this.Initializer); 4420private TypeSyntax? type; 4430public TypeSyntax? Type => GetRed(ref this.type, 1); 4458public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) 4471public FromClauseSyntax WithType(TypeSyntax? type) => Update(this.FromKeyword, type, this.Identifier, this.InKeyword, this.Expression); 4534private TypeSyntax? type; 4547public TypeSyntax? Type => GetRed(ref this.type, 1); 4591public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) 4604public JoinClauseSyntax WithType(TypeSyntax? type) => Update(this.JoinKeyword, type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); 5240private TypeSyntax? type; 5248public TypeSyntax Type => GetRedAtZero(ref this.type)!; 5271public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) 5283public DeclarationPatternSyntax WithType(TypeSyntax type) => Update(type, this.Designation); 5337private TypeSyntax? type; 5347public TypeSyntax? Type => GetRedAtZero(ref this.type); 5378public RecursivePatternSyntax Update(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) 5390public RecursivePatternSyntax WithType(TypeSyntax? type) => Update(type, this.PositionalPatternClause, this.PropertyPatternClause, this.Designation); 5706private TypeSyntax? type; 5714public TypeSyntax Type => GetRedAtZero(ref this.type)!; 5723public TypePatternSyntax Update(TypeSyntax type) 5735public TypePatternSyntax WithType(TypeSyntax type) => Update(type); 6317private TypeSyntax? returnType; 6340public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; 6394public LocalFunctionStatementSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 6409public LocalFunctionStatementSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 6543private TypeSyntax? type; 6551public TypeSyntax Type => GetRedAtZero(ref this.type)!; 6581public VariableDeclarationSyntax Update(TypeSyntax type, SeparatedSyntaxList<VariableDeclaratorSyntax> variables) 6593public VariableDeclarationSyntax WithType(TypeSyntax type) => Update(type, this.Variables); 7726private TypeSyntax? type; 7750public TypeSyntax Type => GetRed(ref this.type, 4)!; 7786public ForEachStatementSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 7806public ForEachStatementSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); 9101private TypeSyntax? type; 9110public TypeSyntax Type => GetRed(ref this.type, 1)!; 9130public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) 9143public CatchDeclarationSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.Identifier, this.CloseParenToken); 9380private TypeSyntax? namespaceOrType; 9418public TypeSyntax NamespaceOrType => GetRed(ref this.namespaceOrType, 5)!; 9441public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) 9458public UsingDirectiveSyntax WithNamespaceOrType(TypeSyntax namespaceOrType) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, namespaceOrType, this.SemicolonToken); 11137private TypeSyntax? returnType; 11162public TypeSyntax ReturnType => GetRed(ref this.returnType, 3)!; 11203public DelegateDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken semicolonToken) 11220public DelegateDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); 11526public abstract TypeSyntax Type { get; } 11527public BaseTypeSyntax WithType(TypeSyntax type) => WithTypeCore(type); 11528internal abstract BaseTypeSyntax WithTypeCore(TypeSyntax type); 11539private TypeSyntax? type; 11546public override TypeSyntax Type => GetRedAtZero(ref this.type)!; 11555public SimpleBaseTypeSyntax Update(TypeSyntax type) 11567internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); 11568public new SimpleBaseTypeSyntax WithType(TypeSyntax type) => Update(type); 11579private TypeSyntax? type; 11587public override TypeSyntax Type => GetRedAtZero(ref this.type)!; 11610public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) 11622internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); 11623public new PrimaryConstructorBaseTypeSyntax WithType(TypeSyntax type) => Update(type, this.ArgumentList); 11821private TypeSyntax? type; 11829public TypeSyntax Type => GetRedAtZero(ref this.type)!; 11838public TypeConstraintSyntax Update(TypeSyntax type) 11850public TypeConstraintSyntax WithType(TypeSyntax type) => Update(type); 12281private TypeSyntax? returnType; 12306public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; 12365public MethodDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 12381public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12431private TypeSyntax? returnType; 12454public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; 12517public OperatorDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 12533public OperatorDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); 12578private TypeSyntax? type; 12618public TypeSyntax Type => GetRed(ref this.type, 6)!; 12663public ConversionOperatorDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 12683public ConversionOperatorDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); 13019public abstract TypeSyntax Type { get; } 13020public BasePropertyDeclarationSyntax WithType(TypeSyntax type) => WithTypeCore(type); 13021internal abstract BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type); 13052private TypeSyntax? type; 13074public override TypeSyntax Type => GetRed(ref this.type, 2)!; 13123public PropertyDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) 13139internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); 13140public new PropertyDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); 13214private TypeSyntax? type; 13236public override TypeSyntax Type => GetRed(ref this.type, 3)!; 13277public EventDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) 13294internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); 13295public new EventDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); 13324private TypeSyntax? type; 13346public override TypeSyntax Type => GetRed(ref this.type, 2)!; 13395public IndexerDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 13411internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); 13412public new IndexerDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); 13749public abstract TypeSyntax? Type { get; } 13750public BaseParameterSyntax WithType(TypeSyntax? type) => WithTypeCore(type); 13751internal abstract BaseParameterSyntax WithTypeCore(TypeSyntax? type); 13764private TypeSyntax? type; 13788public override TypeSyntax? Type => GetRed(ref this.type, 2); 13823public ParameterSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) 13839internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type); 13840public new ParameterSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type, this.Identifier, this.Default); 13860private TypeSyntax? type; 13880public override TypeSyntax Type => GetRed(ref this.type, 2)!; 13901public FunctionPointerParameterSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type) 13917internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type ?? throw new ArgumentNullException(nameof(type))); 13918public new FunctionPointerParameterSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type); 13935private TypeSyntax? type; 13953public TypeSyntax? Type => GetRed(ref this.type, 2); 13974public IncompleteMemberSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) 13990public IncompleteMemberSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type); 14117private TypeSyntax? type; 14124public TypeSyntax Type => GetRedAtZero(ref this.type)!; 14133public TypeCrefSyntax Update(TypeSyntax type) 14145public TypeCrefSyntax WithType(TypeSyntax type) => Update(type); 14163private TypeSyntax? container; 14171public TypeSyntax Container => GetRedAtZero(ref this.container)!; 14196public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) 14208public QualifiedCrefSyntax WithContainer(TypeSyntax container) => Update(container, this.DotToken, this.Member); 14242private TypeSyntax? name; 14250public TypeSyntax Name => GetRedAtZero(ref this.name)!; 14273public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax? parameters) 14285public NameMemberCrefSyntax WithName(TypeSyntax name) => Update(name, this.Parameters); 14361public ExtensionMemberCrefSyntax AddTypeArgumentListArguments(params TypeSyntax[] items) 14500private TypeSyntax? type; 14521public TypeSyntax Type => GetRed(ref this.type, 3)!; 14544public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) 14559public ConversionOperatorMemberCrefSyntax WithType(TypeSyntax type) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, type, this.Parameters); 14725private TypeSyntax? type; 14750public TypeSyntax Type => GetRed(ref this.type, 2)!; 14759public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) 14773public CrefParameterSyntax WithType(TypeSyntax type) => Update(this.RefKindKeyword, this.ReadOnlyKeyword, type);
Syntax\ConversionOperatorDeclarationSyntax.cs (2)
14TypeSyntax type, 39TypeSyntax type,
Syntax\ConversionOperatorMemberCrefSyntax.cs (1)
9public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters)
Syntax\CrefParameterSyntax.cs (2)
18/// Pre C# 7.2 back-compat overload, which simply calls the replacement method <see cref="Update(SyntaxToken, TypeSyntax)"/>. 26public CrefParameterSyntax Update(SyntaxToken refKindKeyword, TypeSyntax type)
Syntax\EventDeclarationSyntax.cs (2)
13public EventDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList) 18public EventDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, SyntaxToken semicolonToken)
Syntax\ForEachStatementSyntax.cs (4)
11public ForEachStatementSyntax Update(SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 14public ForEachStatementSyntax Update(SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 23public static ForEachStatementSyntax ForEachStatement(SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 26public static ForEachStatementSyntax ForEachStatement(SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
Syntax\IndexerDeclarationSyntax.cs (1)
39TypeSyntax type,
Syntax\LocalFunctionStatementSyntax.cs (3)
12public LocalFunctionStatementSyntax Update(SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) 24public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) 30public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken)
Syntax\MethodDeclarationSyntax.cs (1)
30TypeSyntax returnType,
Syntax\OperatorDeclarationSyntax.cs (2)
12TypeSyntax returnType, 36TypeSyntax returnType,
Syntax\RefTypeSyntax.cs (2)
11public RefTypeSyntax Update(SyntaxToken refKeyword, TypeSyntax type) 23public static RefTypeSyntax RefType(SyntaxToken refKeyword, TypeSyntax type)
Syntax\StackAllocArrayCreationExpressionSyntax.cs (2)
11public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type) 20public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type)
Syntax\SyntaxExtensions.cs (6)
270TypeSyntax type, 292TypeSyntax returnType, 315TypeSyntax returnType, 401internal static void VisitRankSpecifiers<TArg>(this TypeSyntax type, Action<ArrayRankSpecifierSyntax, TArg> action, in TArg argument) 417type = (TypeSyntax)current; 442TypeSyntax? paramType = functionPointerTypeSyntax.ParameterList.Parameters[i].Type;
Syntax\SyntaxFactory.cs (17)
1734public static TypeSyntax ParseTypeName(string text, int offset, bool consumeFullText) 1742public static TypeSyntax ParseTypeName(string text, int offset = 0, ParseOptions? options = null, bool consumeFullText = true) 1749return CreateRed<TypeSyntax>(node, lexer.Options); 2103internal static TypeSyntax? GetStandaloneType(TypeSyntax? node) 2492TypeSyntax type, 2513TypeSyntax type, 2534TypeSyntax type, 2557TypeSyntax type, 2580TypeSyntax type, 2604TypeSyntax returnType, 2627TypeSyntax returnType, 2652TypeSyntax returnType, 2673TypeSyntax returnType, 2748public static EventDeclarationSyntax EventDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList) 2754public static EventDeclarationSyntax EventDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, SyntaxToken semicolonToken) 2885public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, TypeSyntax type, CrefParameterListSyntax? parameters)
Syntax\SyntaxNodeExtensions.cs (12)
222internal static RefKind GetRefKindInLocalOrReturn(this TypeSyntax syntax, BindingDiagnosticBag diagnostics) 235internal static TypeSyntax SkipRef(this TypeSyntax syntax) 238internal static TypeSyntax SkipRefInField(this TypeSyntax syntax, out RefKind refKind) 245internal static TypeSyntax SkipRefInLocalOrReturn(this TypeSyntax syntax, BindingDiagnosticBag? diagnostics, out RefKind refKind) 248private static TypeSyntax SkipRefWorker(TypeSyntax syntax, BindingDiagnosticBag? diagnostics, out RefKind refKind) 260var current = syntax; 287internal static TypeSyntax SkipScoped(this TypeSyntax syntax, out bool isScoped)
Syntax\SyntaxNormalizer.cs (1)
700if (token.Parent.IsKind(SyntaxKind.ConditionalExpression) || token.Parent is TypeSyntax)
Microsoft.CodeAnalysis.CSharp.Analyzers (2)
MetaAnalyzers\CSharpDiagnosticAnalyzerAPIUsageAnalyzer.cs (1)
12public class CSharpDiagnosticAnalyzerApiUsageAnalyzer : DiagnosticAnalyzerApiUsageAnalyzer<TypeSyntax>
MetaAnalyzers\CSharpDiagnosticAnalyzerFieldsAnalyzer.cs (1)
12public class CSharpDiagnosticAnalyzerFieldsAnalyzer : DiagnosticAnalyzerFieldsAnalyzer<ClassDeclarationSyntax, StructDeclarationSyntax, FieldDeclarationSyntax, TypeSyntax, VariableDeclarationSyntax, TypeArgumentListSyntax, GenericNameSyntax>
Microsoft.CodeAnalysis.CSharp.CodeStyle (64)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
61var typeSyntax = declarationPattern.Type;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
295n => n is TypeSyntax or
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (4)
61private static bool IsLanguageRestrictedToNonNullForm(TypeSyntax node) 107static TypeSyntax WalkUpCurrentQualifiedName(TypeSyntax node) 128if (node is TypeSyntax typeSyntax
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (3)
75Right: TypeSyntax whereTypeSyntax 94[NotNullWhen(true)] out TypeSyntax? caseOrSelectType) 192out var castTypeArgument))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
795Func<TArrayCreationExpressionSyntax, TypeSyntax> getType,
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (2)
137TypeSyntax typeNode, 218private static bool IsViableTupleTypeSyntax(TypeSyntax type)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
85TypeSyntax? typeNode;
src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
51var declaredType = Helper.FindAnalyzableType(declarationStatement, semanticModel, cancellationToken);
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (3)
34if (binaryExpression.Right is not TypeSyntax typeSyntax) 75public readonly TypeSyntax TypeSyntax; 77private Type(TypeSyntax type, IOperation target) : base(target)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (1)
81BinaryExpressionSyntax(SyntaxKind.IsExpression) { Right: TypeSyntax type } isExpression
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
70foreach (var argument in typeArgumentList.Arguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
202public static bool IsPredefinedType(TypeSyntax type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
42var typeSyntax = GetTypeSyntax(equalsValueClause); 67private static TypeSyntax GetTypeSyntax(EqualsValueClauseSyntax equalsValueClause)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
606while (topExpression.Parent is TypeSyntax typeSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (1)
150public static TypeSyntax GetMemberType(this MemberDeclarationSyntax member)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (5)
185TypeSyntax type, 319TypeSyntax type, 344private static TypeSyntax GetOutermostType(TypeSyntax type) 345=> type.GetAncestorsOrThis<TypeSyntax>().Last();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (5)
13public static bool IsVoid(this TypeSyntax typeSyntax) 17public static bool IsPartial(this TypeSyntax typeSyntax) 26public static bool IsTypeInferred(this TypeSyntax typeSyntax, SemanticModel semanticModel) 52public static TypeSyntax StripRefIfNeeded(this TypeSyntax type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\VariableDeclaratorExtensions.cs (2)
13public static TypeSyntax GetVariableType(this VariableDeclaratorSyntax declarator) 25var variableTypeName = variable.GetVariableType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
758var type = memberDeclaration.GetMemberType(); 1477=> node is TypeSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (2)
117var xArg = x.TypeArgumentList.Arguments[i]; 118var yArg = y.TypeArgumentList.Arguments[i];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (3)
32TypeSyntax, 96=> node is StatementSyntax(kind: not SyntaxKind.Block) or TypeSyntax or CrefSyntax || 141if (nodeToSpeculate is TypeSyntax typeNode)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (4)
35TypeSyntax typeName, SemanticModel semanticModel, 54TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 57SyntaxToken identifier, TypeSyntax typeName, ExpressionSyntax initializer, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 59internal TypeSyntax? FindAnalyzableType(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (3)
109var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 148var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 155private static TypeSyntax? GetTypeSyntaxFromDeclaration(SyntaxNode declarationStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (3)
60TypeSyntax typeName, SemanticModel semanticModel, 135TypeSyntax typeName, 149private static bool ContainsAnonymousType(TypeSyntax typeName, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
30TypeSyntax typeName, SemanticModel semanticModel, 50var type = variableDeclaration.Type.StripRefIfNeeded(); 61var type = forEachStatement.Type.StripRefIfNeeded(); 92TypeSyntax typeName, SemanticModel semanticModel, 174var declarationTypeNode = declarationExpression.Type; 241TypeSyntax typeName,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (5)
11: IComparer<TypeSyntax?> 16public int Compare(TypeSyntax? x, TypeSyntax? y) 41private static TypeSyntax UnwrapType(TypeSyntax type)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (122)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
111var type = cannotUseVar ? declaratorToRemoveType!.GenerateTypeSyntax() : IdentifierName("var");
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
254var type = result.IsInherited
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (8)
57static bool IsVoid(TypeSyntax typeSyntax) 61private static async Task<(TypeSyntax declarationToFix, TypeSyntax fixedDeclaration)> TryGetOldAndNewReturnTypeAsync( 89var fixedDeclaration = returnedType.GenerateTypeSyntax(allowVar: false); 117var taskTypeSyntax = taskType.GenerateTypeSyntax(allowVar: false); 118fixedDeclaration = (TypeSyntax)syntaxGenerator.WithTypeArguments(taskTypeSyntax, fixedDeclaration); 134private static (TypeSyntax type, bool isAsync) TryGetDeclarationTypeToFix(SyntaxNode node) 138static (TypeSyntax type, bool isAsync) TryGetReturnTypeToFix(SyntaxNode containingMember)
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
43var node = semanticDocument.Root.FindToken(textSpan.Start).GetAncestor<TypeSyntax>();
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (4)
87foreach (var type in genericName.TypeArgumentList.Arguments) 104TypeSyntax type, 112private ITypeParameterSymbol? GetMethodTypeParameter(TypeSyntax type, CancellationToken cancellationToken) 151foreach (var typeArgument in genericName.TypeArgumentList.Arguments)
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceCodeFixProvider.cs (1)
19: AbstractImplementInterfaceCodeFixProvider<TypeSyntax>
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
56if (node is TypeSyntax interfaceNode && interfaceNode.Parent is BaseTypeSyntax baseType &&
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (4)
219var newType = GenerateTypeSyntaxOrVar(local.Type, options); 232var explicitType = declaration.Type.IsVar ? local.Type?.GenerateTypeSyntax() : declaration.Type; 241public static TypeSyntax GenerateTypeSyntaxOrVar( 269TypeSyntax newType, VariableDeclaratorSyntax declaratorOpt)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
74var newReturnType = ienumerableGenericSymbol.GenerateTypeSyntax();
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (8)
98var fixedReturnType = FixMethodReturnType(keepVoid, methodSymbol, method.ReturnType, knownTypes); 123private static TypeSyntax FixMethodReturnType( 126TypeSyntax returnTypeSyntax, 129var newReturnType = returnTypeSyntax.WithAdditionalAnnotations(Formatter.Annotation); 167static TypeSyntax MakeGenericType(string type, ITypeSymbol typeArgumentFrom) 187private static (SyntaxTokenList newModifiers, TypeSyntax newReturnType) AddAsyncModifierWithCorrectedTrivia(SyntaxTokenList modifiers, TypeSyntax returnType) 208var newReturnType = returnType.WithoutLeadingTrivia();
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
189var newType = await Simplifier.ExpandAsync(usingDirective.NamespaceOrType, document, cancellationToken: cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (10)
48var declarationTypeToFix = await TryGetDeclarationTypeToFixAsync( 80using var _ = PooledHashSet<TypeSyntax>.GetInstance(out var alreadyHandled); 99Document document, SemanticModel model, SyntaxEditor editor, SyntaxNode node, HashSet<TypeSyntax> alreadyHandled, CancellationToken cancellationToken) 101var declarationTypeToFix = await TryGetDeclarationTypeToFixAsync( 110private static async Task<TypeSyntax?> TryGetDeclarationTypeToFixAsync( 269static TypeSyntax? TryGetReturnType(TypeSyntax returnType, SyntaxTokenList modifiers, bool onYield) 283static TypeSyntax? TryGetSingleTypeArgument(TypeSyntax type) 301static TypeSyntax? TryGetParameterTypeSyntax(IParameterSymbol? parameterSymbol, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastCodeFixProvider.cs (2)
47var typeSyntax = (TypeSyntax)diagnostic.AdditionalLocations[1].FindNode(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (2)
146private ExpressionSyntax CreateTupleOrDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode) 157private static DeclarationExpressionSyntax CreateDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode)
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
147var arrayElementTypeNode = arrayElementType.GenerateTypeSyntax(allowVar: false);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (6)
93var typeSyntax = declarationExpression.Type; 141TypeSyntax typeSyntax, 208var typeName = type.GenerateTypeSyntax(allowVar: false); 235private static TypeSyntax GenerateTypeDeclaration(TypeSyntax typeSyntax, ITypeSymbol newTypeSymbol) 239var newTypeSyntax = newTypeSymbol
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (3)
48var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 55internal static void ReplaceTypeWithVar(SyntaxEditor editor, TypeSyntax type)
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (2)
38private static readonly TypeSyntax s_objectType = PredefinedType(ObjectKeyword); 216var returnType = delegateMethod.GenerateReturnTypeSyntax();
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
76(TypeSyntax)asExpression.Right.WithAppendedTrailingTrivia(Space),
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (2)
133TypeSyntax GetPatternType() 156return (TypeSyntax)asExpression.Right;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
63((TypeSyntax)isExpression.Right).WithoutTrivia(),
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
70return current.WithArguments(SeparatedList<TypeSyntax>(list));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
783TypeSyntax newTypeSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
158private static TypeSyntax GenerateTypeSyntax(IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (2)
283if (expr is TypeSyntax) 493targetToken.GetPreviousToken(includeSkipped: true).IsLastTokenOfNode<TypeSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (11)
950{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 1516if (leftToken.IsLastTokenOfNode<TypeSyntax>(out var typeSyntax)) 1521while (typeSyntax.Parent is TypeSyntax parentTypeSyntax) 2326if (binary.Left is TypeSyntax type && type.IsPotentialTypeName(semanticModel, cancellationToken)) 2347var type = previousToken.Parent as TypeSyntax; 2353var underlyingType = type is PointerTypeSyntax pointerType 2387return conditionalExpression.Condition is not TypeSyntax type 2848var type = token.GetAncestors<TypeSyntax>().LastOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
115var typeSyntax = targetType.GenerateTypeSyntax();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (7)
33public static TypeSyntax GenerateTypeSyntax(this INamespaceOrTypeSymbol symbol, bool allowVar = true) 36private static TypeSyntax GenerateTypeSyntax( 47var syntax = containsAnonymousType 71public static TypeSyntax GenerateRefTypeSyntax( 74var underlyingType = GenerateTypeSyntax(symbol, allowVar) 81public static TypeSyntax GenerateRefReadOnlyTypeSyntax( 84var underlyingType = GenerateTypeSyntax(symbol, allowVar)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
43if (!_nameOnly && TypeSyntaxGeneratorVisitor.TryCreateNativeIntegerType(symbol, out var typeSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (24)
22private sealed class TypeSyntaxGeneratorVisitor(bool nameOnly) : SymbolVisitor<TypeSyntax> 39public override TypeSyntax DefaultVisit(ISymbol node) 43where TTypeSyntax : TypeSyntax 51public override TypeSyntax VisitAlias(IAliasSymbol symbol) 62public override TypeSyntax VisitArrayType(IArrayTypeSymbol symbol) 92var elementTypeSyntax = underlyingType.GenerateTypeSyntax(); 104TypeSyntax arrayTypeSyntax = ArrayType(elementTypeSyntax, [.. ranks]); 114public override TypeSyntax VisitDynamicType(IDynamicTypeSymbol symbol) 122public static bool TryCreateNativeIntegerType(INamedTypeSymbol symbol, [NotNullWhen(true)] out TypeSyntax? syntax) 134public override TypeSyntax VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 178public TypeSyntax CreateSimpleTypeSyntax(INamedTypeSymbol symbol) 182var syntax = TryCreateSpecializedNamedTypeSyntax(symbol); 204? Enumerable.Repeat((TypeSyntax)OmittedTypeArgument(), symbol.TypeArguments.Length) 218private static TypeSyntax? TryCreateSpecializedNamedTypeSyntax(INamedTypeSymbol symbol) 257public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol) 259if (TryCreateNativeIntegerType(symbol, out var typeSyntax)) 271var containingTypeSyntax = symbol.ContainingType.Accept(this); 295var container = symbol.ContainingNamespace.Accept(this)!; 312public override TypeSyntax VisitNamespace(INamespaceSymbol symbol) 326var container = symbol.ContainingNamespace.Accept(this)!; 337private static TypeSyntax AddGlobalAlias(INamespaceOrTypeSymbol symbol, SimpleNameSyntax syntax) 345public override TypeSyntax VisitPointerType(IPointerTypeSymbol symbol) 354public override TypeSyntax VisitTypeParameter(ITypeParameterSymbol symbol) 356TypeSyntax typeSyntax = AddInformationTo(symbol.Name.ToIdentifierName(), symbol);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
16public static bool IsPotentialTypeName([NotNullWhen(true)] this TypeSyntax? typeSyntax, SemanticModel? semanticModelOpt, CancellationToken cancellationToken) 55public static TypeSyntax GenerateReturnTypeSyntax(this IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (1)
57var type = declarationStatement.Declaration.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (7)
79type == null ? SyntaxFactory.IdentifierName("var") : (TypeSyntax)type, 248=> SyntaxFactory.TypePattern((TypeSyntax)type); 256=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)ParenthesizeNonSimple(expression)).WithAdditionalAnnotations(Simplifier.Annotation); 259=> SyntaxFactory.DefaultExpression((TypeSyntax)type).WithAdditionalAnnotations(Simplifier.Annotation); 298var type = typeSymbol.GenerateTypeSyntax(); 323if (expression is TypeSyntax || 349=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)ParenthesizeNonSimple(expression)).WithAdditionalAnnotations(Simplifier.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2174var variableType = variableDeclarator.GetVariableType();
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (2)
426var typeNode = objectCreationExpressionNode.Type; 441var newTypeNode = typeNode.WithoutTrivia();
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
TypeInferrer\TypeInferrerTests.cs (1)
43var typeSyntax = inferredType.GenerateTypeSyntax().NormalizeWhitespace();
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (21)
CodeGen\CodeGenDeconstructTests.cs (18)
3587var typeSyntax = GetTypeSyntax(decl); 3628private static TypeSyntax GetTypeSyntax(SingleVariableDesignationSyntax decl) 3699var x1Type = GetTypeSyntax(x1); 3704var x2Type = GetTypeSyntax(x2); 3752var x1Type = GetTypeSyntax(x1); 3801var x1Type = GetTypeSyntax(x1); 3809var x2Type = GetTypeSyntax(x2); 3941var x1Type = GetTypeSyntax(x1); 3946var x2Type = GetTypeSyntax(x2); 3987var x1Type = GetTypeSyntax(x1); 3992var x2Type = GetTypeSyntax(x2); 5034var xType = GetTypeSyntax(x); 5040var yType = GetTypeSyntax(y); 5186var x1Type = GetTypeSyntax(x1); 5817var x1Type = GetTypeSyntax(x1); 5825var x3Type = GetTypeSyntax(x3); 5869var x1Type = GetTypeSyntax(x1); 5875var x3Type = GetTypeSyntax(x3);
CodeGen\CodeGenRefLocalTests.cs (3)
4046var type = refVar.Type; 4083var type = refVar.Type; 4117var type = refInt.Type;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (5)
Attributes\AttributeTests.cs (1)
7582var typeofArgSyntax = typeofSyntax.Type;
Semantics\OutVarTests.cs (1)
1034var typeSyntax = decl.Type;
Semantics\PatternMatchingTestBase.cs (3)
102var typeSyntax = decl.Type; 130private static void AssertTypeInfo(SemanticModel model, TypeSyntax typeSyntax, ITypeSymbol expectedType) 268var typeSyntax = decl.Type;
Microsoft.CodeAnalysis.CSharp.Features (161)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
137var additionalTypeArguments = additionalTypeParameters.SelectAsArray(p => (TypeSyntax)p.Name.ToIdentifierName());
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
459var type = localSymbol.Type.GenerateTypeSyntax();
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
183var container = qualifiedCref.Container;
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (7)
23protected abstract Task HandleDeclarationAsync(Document document, SyntaxEditor editor, TypeSyntax type, CancellationToken cancellationToken); 24protected abstract TypeSyntax FindAnalyzableType(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken); 25protected abstract TypeStyleResult AnalyzeTypeName(TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 44var declaredType = FindAnalyzableType(declaration, semanticModel, cancellationToken); 94var type = await context.TryGetRelevantNodeAsync<TypeSyntax>().ConfigureAwait(false); 118private async Task<Document> UpdateDocumentAsync(Document document, TypeSyntax type, CancellationToken cancellationToken)
CodeRefactorings\UseExplicitOrImplicitType\UseExplicitTypeCodeRefactoringProvider.cs (3)
29protected override TypeSyntax FindAnalyzableType(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken) 32protected override TypeStyleResult AnalyzeTypeName(TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken) 35protected override Task HandleDeclarationAsync(Document document, SyntaxEditor editor, TypeSyntax node, CancellationToken cancellationToken)
CodeRefactorings\UseExplicitOrImplicitType\UseImplicitTypeCodeRefactoringProvider.cs (3)
29protected override TypeSyntax FindAnalyzableType(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken) 32protected override TypeStyleResult AnalyzeTypeName(TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken) 35protected override Task HandleDeclarationAsync(Document document, SyntaxEditor editor, TypeSyntax type, CancellationToken cancellationToken)
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (3)
274TypeSyntax type when originalReceiver.IsParentKind(IsExpression) => TypePattern(type), 360BinaryExpressionSyntax(IsExpression) { Right: TypeSyntax type } expr => (expr.Left, type, Flipped: false), 406private static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, SubpatternSyntax subpattern, VariableDesignationSyntax? designation)
Completion\CompletionProviders\AwaitCompletionProvider.cs (2)
54var existingReturnType = declaration switch 76string? GetNewTypeName(TypeSyntax existingReturnType)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (2)
138SemanticModel semanticModel, SyntaxToken token, TypeSyntax type, out NameDeclarationInfo result) 192var type = SyntaxFactory.ParseTypeName(sourceText.ToString(subSpan));
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (3)
77var typeNode = potentialTypeNode as TypeSyntax; 81if (typeNode.Parent is TypeSyntax parentType && parentType.Span.End < position)
Completion\CompletionProviders\OverrideCompletionProvider.cs (1)
53if (startToken.Parent is TypeSyntax typeSyntax)
Completion\KeywordRecommenders\CheckedKeywordRecommender.cs (2)
30if (previousPossiblySkippedToken.IsLastTokenOfNode<TypeSyntax>()) 41if (firstSpecifierToken.GetPreviousToken(includeSkipped: true).IsLastTokenOfNode<TypeSyntax>())
Completion\KeywordRecommenders\InKeywordRecommender.cs (2)
88var typeSyntax = token.Parent as TypeSyntax;
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (3)
24: AbstractConvertCastCodeRefactoringProvider<TypeSyntax, CastExpressionSyntax, BinaryExpressionSyntax> 37protected override TypeSyntax GetTypeNode(CastExpressionSyntax from) 42var typeNode = castExpression.Type;
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (4)
26: AbstractConvertCastCodeRefactoringProvider<TypeSyntax, BinaryExpressionSyntax, CastExpressionSyntax> 39protected override TypeSyntax GetTypeNode(BinaryExpressionSyntax expression) 40=> (TypeSyntax)expression.Right; 45var typeNode = GetTypeNode(asExpression);
ConvertForEachToFor\CSharpConvertForEachToForCodeRefactoringProvider.cs (1)
72var collectionStatementType = typeSymbol.GenerateTypeSyntax();
ConvertForToForEach\CSharpConvertForToForEachCodeRefactoringProvider.cs (2)
24TypeSyntax, 114TypeSyntax? typeNode,
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (2)
115AnalyzedPattern.Type p when feature.HasFlag(Feature.TypePattern) => TypePattern((TypeSyntax)p.IsExpressionSyntax.Right), 116AnalyzedPattern.Type p => DeclarationPattern((TypeSyntax)p.IsExpressionSyntax.Right, DiscardDesignation()),
ConvertLinq\ConvertForEachToLinqQuery\DefaultConverter.cs (1)
23private static readonly TypeSyntax VarNameIdentifier = IdentifierName("var");
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (2)
33private static readonly TypeSyntax VarNameIdentifier = IdentifierName("var"); 520var typeSyntax = generateTypeFromExpression
Debugging\DataTipInfoGetter.cs (1)
36else if (expression is TypeSyntax typeSyntax && typeSyntax.IsVar)
Diagnostics\Analyzers\CSharpPreferFrameworkTypeDiagnosticAnalyzer.cs (1)
18TypeSyntax,
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (3)
137var returnType = member.GetMemberType(); 177else if (expression is ObjectCreationExpressionSyntax { Type: TypeSyntax exceptionType }) 190private static bool IsExceptionCaughtAndNotRethrown(bool hasUsingSystem, TypeSyntax exceptionType)
EditAndContinue\SyntaxComparer.cs (3)
949GetNestedFunctionsParts(leftNode, out var leftParameters, out var leftAsync, out var leftBody, out var leftModifiers, out var leftReturnType, out var leftIdentifier, out var leftTypeParameters); 950GetNestedFunctionsParts(rightNode, out var rightParameters, out var rightAsync, out var rightBody, out var rightModifiers, out var rightReturnType, out var rightIdentifier, out var rightTypeParameters); 979out TypeSyntax? returnType,
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (4)
315private SeparatedSyntaxList<TypeSyntax> CreateMethodCallTypeVariables() 763var typeSyntax = declarationStatement.Declaration.Type; 1069var returnType = syntaxNode is MethodDeclarationSyntax method ? method.ReturnType : ((LocalFunctionStatementSyntax)syntaxNode).ReturnType; 1118TypeSyntax returnType,
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
163var parsedType = ParseTypeName(localText, startIndex, consumeFullText: false);
GenerateType\CSharpGenerateTypeService.cs (5)
56if (expression is TypeSyntax typeSyntax && expression.Parent is TypeArgumentListSyntax typeArgumentList) 86if (expression is TypeSyntax { Parent: BaseTypeSyntax { Parent: BaseListSyntax baseList } baseType } && 101if (expression is TypeSyntax { Parent: TypeConstraintSyntax { Parent: TypeParameterConstraintClauseSyntax constraintClause } typeConstraint }) 455state.NameOrMemberAccessExpression as TypeSyntax, cancellationToken); 464state.NameOrMemberAccessExpression as TypeSyntax, cancellationToken);
IntroduceVariable\CSharpIntroduceVariableService.cs (1)
25AbstractIntroduceVariableService<CSharpIntroduceVariableService, ExpressionSyntax, TypeSyntax, TypeDeclarationSyntax, QueryExpressionSyntax, NameSyntax>
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
228private static TypeSyntax GetTypeSyntax(SemanticDocument document, ExpressionSyntax expression, CancellationToken cancellationToken)
Rename\CSharpRenameIssuesService.cs (1)
61TypeSyntax? declaredType = null;
ReplaceConditionalWithStatements\CSharpReplaceConditionalWithStatementsCodeRefactoringProvider.cs (1)
70var type = localDeclarationStatement.Declaration.Type;
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
303if (parameterType is TypeSyntax typeSyntax)
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (1)
81var type = propertyDeclaration.Type;
Snippets\AbstractCSharpForLoopSnippetProvider.cs (1)
70static (TypeSyntax iteratorTypeSyntax, SyntaxNode? inlineExpression) GetLoopHeaderParts(SyntaxGenerator generator, InlineExpressionInfo? inlineExpressionInfo, Compilation compilation)
Snippets\AbstractCSharpMainMethodSnippetProvider.cs (1)
15: AbstractMainMethodSnippetProvider<MethodDeclarationSyntax, StatementSyntax, TypeSyntax>
Snippets\CSharpIntMainSnippetProvider.cs (2)
30protected override TypeSyntax GenerateReturnType(SyntaxGenerator generator) 31=> (TypeSyntax)generator.TypeExpression(SpecialType.System_Int32);
Snippets\CSharpVoidMainSnippetProvider.cs (1)
30protected override TypeSyntax GenerateReturnType(SyntaxGenerator generator)
SolutionExplorer\CSharpSolutionExplorerSymbolTreeItemProvider.cs (1)
379private static void AppendType(TypeSyntax? type, StringBuilder builder)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
61var typeSyntax = declarationPattern.Type;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
295n => n is TypeSyntax or
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (4)
61private static bool IsLanguageRestrictedToNonNullForm(TypeSyntax node) 107static TypeSyntax WalkUpCurrentQualifiedName(TypeSyntax node) 128if (node is TypeSyntax typeSyntax
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (3)
75Right: TypeSyntax whereTypeSyntax 94[NotNullWhen(true)] out TypeSyntax? caseOrSelectType) 192out var castTypeArgument))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
795Func<TArrayCreationExpressionSyntax, TypeSyntax> getType,
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (2)
137TypeSyntax typeNode, 218private static bool IsViableTupleTypeSyntax(TypeSyntax type)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
85TypeSyntax? typeNode;
src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
51var declaredType = Helper.FindAnalyzableType(declarationStatement, semanticModel, cancellationToken);
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (3)
34if (binaryExpression.Right is not TypeSyntax typeSyntax) 75public readonly TypeSyntax TypeSyntax; 77private Type(TypeSyntax type, IOperation target) : base(target)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (1)
81BinaryExpressionSyntax(SyntaxKind.IsExpression) { Right: TypeSyntax type } isExpression
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
70foreach (var argument in typeArgumentList.Arguments)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
111var type = cannotUseVar ? declaratorToRemoveType!.GenerateTypeSyntax() : IdentifierName("var");
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
254var type = result.IsInherited
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (8)
57static bool IsVoid(TypeSyntax typeSyntax) 61private static async Task<(TypeSyntax declarationToFix, TypeSyntax fixedDeclaration)> TryGetOldAndNewReturnTypeAsync( 89var fixedDeclaration = returnedType.GenerateTypeSyntax(allowVar: false); 117var taskTypeSyntax = taskType.GenerateTypeSyntax(allowVar: false); 118fixedDeclaration = (TypeSyntax)syntaxGenerator.WithTypeArguments(taskTypeSyntax, fixedDeclaration); 134private static (TypeSyntax type, bool isAsync) TryGetDeclarationTypeToFix(SyntaxNode node) 138static (TypeSyntax type, bool isAsync) TryGetReturnTypeToFix(SyntaxNode containingMember)
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
43var node = semanticDocument.Root.FindToken(textSpan.Start).GetAncestor<TypeSyntax>();
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (4)
87foreach (var type in genericName.TypeArgumentList.Arguments) 104TypeSyntax type, 112private ITypeParameterSymbol? GetMethodTypeParameter(TypeSyntax type, CancellationToken cancellationToken) 151foreach (var typeArgument in genericName.TypeArgumentList.Arguments)
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceCodeFixProvider.cs (1)
19: AbstractImplementInterfaceCodeFixProvider<TypeSyntax>
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
56if (node is TypeSyntax interfaceNode && interfaceNode.Parent is BaseTypeSyntax baseType &&
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (4)
219var newType = GenerateTypeSyntaxOrVar(local.Type, options); 232var explicitType = declaration.Type.IsVar ? local.Type?.GenerateTypeSyntax() : declaration.Type; 241public static TypeSyntax GenerateTypeSyntaxOrVar( 269TypeSyntax newType, VariableDeclaratorSyntax declaratorOpt)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
74var newReturnType = ienumerableGenericSymbol.GenerateTypeSyntax();
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (8)
98var fixedReturnType = FixMethodReturnType(keepVoid, methodSymbol, method.ReturnType, knownTypes); 123private static TypeSyntax FixMethodReturnType( 126TypeSyntax returnTypeSyntax, 129var newReturnType = returnTypeSyntax.WithAdditionalAnnotations(Formatter.Annotation); 167static TypeSyntax MakeGenericType(string type, ITypeSymbol typeArgumentFrom) 187private static (SyntaxTokenList newModifiers, TypeSyntax newReturnType) AddAsyncModifierWithCorrectedTrivia(SyntaxTokenList modifiers, TypeSyntax returnType) 208var newReturnType = returnType.WithoutLeadingTrivia();
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
189var newType = await Simplifier.ExpandAsync(usingDirective.NamespaceOrType, document, cancellationToken: cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (10)
48var declarationTypeToFix = await TryGetDeclarationTypeToFixAsync( 80using var _ = PooledHashSet<TypeSyntax>.GetInstance(out var alreadyHandled); 99Document document, SemanticModel model, SyntaxEditor editor, SyntaxNode node, HashSet<TypeSyntax> alreadyHandled, CancellationToken cancellationToken) 101var declarationTypeToFix = await TryGetDeclarationTypeToFixAsync( 110private static async Task<TypeSyntax?> TryGetDeclarationTypeToFixAsync( 269static TypeSyntax? TryGetReturnType(TypeSyntax returnType, SyntaxTokenList modifiers, bool onYield) 283static TypeSyntax? TryGetSingleTypeArgument(TypeSyntax type) 301static TypeSyntax? TryGetParameterTypeSyntax(IParameterSymbol? parameterSymbol, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastCodeFixProvider.cs (2)
47var typeSyntax = (TypeSyntax)diagnostic.AdditionalLocations[1].FindNode(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (2)
146private ExpressionSyntax CreateTupleOrDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode) 157private static DeclarationExpressionSyntax CreateDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode)
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
147var arrayElementTypeNode = arrayElementType.GenerateTypeSyntax(allowVar: false);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (6)
93var typeSyntax = declarationExpression.Type; 141TypeSyntax typeSyntax, 208var typeName = type.GenerateTypeSyntax(allowVar: false); 235private static TypeSyntax GenerateTypeDeclaration(TypeSyntax typeSyntax, ITypeSymbol newTypeSymbol) 239var newTypeSyntax = newTypeSymbol
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (3)
48var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 55internal static void ReplaceTypeWithVar(SyntaxEditor editor, TypeSyntax type)
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (2)
38private static readonly TypeSyntax s_objectType = PredefinedType(ObjectKeyword); 216var returnType = delegateMethod.GenerateReturnTypeSyntax();
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
76(TypeSyntax)asExpression.Right.WithAppendedTrailingTrivia(Space),
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (2)
133TypeSyntax GetPatternType() 156return (TypeSyntax)asExpression.Right;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
63((TypeSyntax)isExpression.Right).WithoutTrivia(),
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
70return current.WithArguments(SeparatedList<TypeSyntax>(list));
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (3)
124var type = (TypeSyntax)isExpression.Right; 224SyntaxFactory.DeclarationPattern((TypeSyntax)isExpression.Right.WithTrailingTrivia(SyntaxFactory.Space),
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (37)
Microsoft.NetCore.Analyzers\InteropServices\CSharpDisableRuntimeMarshalling.Fixer.cs (2)
98editor.ReplaceNode(syntax, SyntaxFactory.SizeOfExpression((TypeSyntax)editor.Generator.TypeExpression(operation.TargetMethod.TypeArguments[0]))); 194static TypeSyntax GetTypeOfTypeSyntax(TypeOfExpressionSyntax syntax)
Microsoft.NetCore.Analyzers\Performance\CSharpPreferDictionaryTryMethodsOverContainsKeyGuardFixer.cs (3)
131TypeSyntax typeSyntax; 134typeSyntax = (TypeSyntax)generator.TypeExpression(type); 136typeSyntax = (TypeSyntax)generator.NullableTypeExpression(typeSyntax);
Microsoft.NetCore.Analyzers\Performance\CSharpUseStartsWithInsteadOfIndexOfComparisonWithZero.Fixer.cs (1)
26(TypeSyntax)generator.TypeExpression(SpecialType.System_Char),
Microsoft.NetCore.Analyzers\Runtime\CSharpDetectPreviewFeatureAnalyzer.cs (11)
44TypeSyntax parameterType = fieldDeclaration.Type; 64private static TypeSyntax GetElementTypeForNullableAndArrayTypeNodes(TypeSyntax parameterType) 91TypeSyntax parameterType = parameter.Type!; 122TypeSyntax returnType = propertyDeclaration.Type; 138TypeSyntax returnType = methodDeclaration.ReturnType; 166foreach (TypeSyntax typeArgument in typeArgumentList.Arguments) 168TypeSyntax typeArgumentElementType = GetElementTypeForNullableAndArrayTypeNodes(typeArgument); 226TypeSyntax typeConstraintSyntaxType = typeConstraintSyntax.Type; 276TypeSyntax type = simpleBaseTypeSyntax.Type; 300private static bool IsIdentifierNameSyntax(TypeSyntax identifier, ISymbol previewInterfaceSymbol) => identifier is IdentifierNameSyntax identifierName && IsSyntaxToken(identifierName.Identifier, previewInterfaceSymbol) ||
Microsoft.NetCore.Analyzers\Runtime\CSharpForwardCancellationTokenToInvocationsFixer.TypeNameVisitor.cs (18)
16private class TypeNameVisitor : SymbolVisitor<TypeSyntax> 18public static TypeSyntax GetTypeSyntaxForSymbol(INamespaceOrTypeSymbol symbol) 23public override TypeSyntax DefaultVisit(ISymbol symbol) 26public override TypeSyntax VisitAlias(IAliasSymbol symbol) 31public override TypeSyntax VisitDynamicType(IDynamicTypeSymbol symbol) 36public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol) 38if (TryCreateNativeIntegerType(symbol, out var typeSyntax)) 49var containingTypeSyntax = symbol.ContainingType.Accept(this); 72var container = symbol.ContainingNamespace.Accept(this)!; 88public override TypeSyntax VisitNamespace(INamespaceSymbol symbol) 102var container = symbol.ContainingNamespace.Accept(this)!; 109public override TypeSyntax VisitTypeParameter(ITypeParameterSymbol symbol) 111TypeSyntax typeSyntax = AddInformationTo(ToIdentifierName(symbol.Name)); 118private TypeSyntax CreateSimpleTypeSyntax(INamedTypeSymbol symbol) 141? Enumerable.Repeat((TypeSyntax)OmittedTypeArgument(), symbol.TypeArguments.Length) 159where TTypeSyntax : TypeSyntax 169private static TypeSyntax AddGlobalAlias(SimpleNameSyntax syntax) 180private static bool TryCreateNativeIntegerType(INamedTypeSymbol symbol, [NotNullWhen(true)] out TypeSyntax? syntax)
Microsoft.NetCore.Analyzers\Runtime\CSharpPreventNumericIntPtrUIntPtrBehavioralChanges.cs (2)
54var type = GetType(definition); 84private static TypeSyntax? GetType(SyntaxNode syntax) =>
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (55)
Semantics\ArglistTests.cs (1)
963var type = stmt.Declaration.Type;
Semantics\ForEachTests.cs (1)
3410var varSyntax = foreachSyntax.Type;
Semantics\LambdaTests.cs (1)
5637var returnTypeSyntax = lambdaSyntax.ReturnType;
Semantics\NativeIntegerTests.cs (1)
4080var typeSyntax = SyntaxFactory.ParseTypeName("nuint");
Semantics\NullableContextTests.cs (1)
2229var type = SyntaxFactory.ParseTypeName(typeName);
Semantics\NullableReferenceTypesTests.cs (20)
10540var type1 = foreachSyntax[0].Type; 10544var type2 = foreachSyntax[1].Type; 113913TypeSyntax type = SyntaxFactory.ParseTypeName( 113922private static void AssertGetSpeculativeTypeInfo(string source, NullableContextOptions nullableContextOptions, TypeSyntax type, string expected) 113950TypeSyntax type = SyntaxFactory.ParseTypeName( 113975TypeSyntax type = SyntaxFactory.ParseTypeName( 114000TypeSyntax type = SyntaxFactory.ParseTypeName( 114029TypeSyntax type = SyntaxFactory.ParseTypeName( 114056TypeSyntax type = SyntaxFactory.ParseTypeName( 114084TypeSyntax type = SyntaxFactory.ParseTypeName( 114112TypeSyntax type = SyntaxFactory.ParseTypeName( 114138TypeSyntax type = SyntaxFactory.ParseTypeName( 114147private static void AssertTryGetSpeculativeSemanticModel(string source, NullableContextOptions nullableContextOptions, TypeSyntax type, string expected) 114176TypeSyntax type = SyntaxFactory.ParseTypeName( 114201TypeSyntax type = SyntaxFactory.ParseTypeName( 114226TypeSyntax type = SyntaxFactory.ParseTypeName( 114255TypeSyntax type = SyntaxFactory.ParseTypeName( 114282TypeSyntax type = SyntaxFactory.ParseTypeName( 114310TypeSyntax type = SyntaxFactory.ParseTypeName( 114338TypeSyntax type = SyntaxFactory.ParseTypeName(
Semantics\RefFieldTests.cs (27)
12140var type = ((VariableDeclarationSyntax)decl.Parent).Type; 12208var type = ((VariableDeclarationSyntax)decl.Parent).Type; 12274var type = ((VariableDeclarationSyntax)decl.Parent).Type; 12463var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12495var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12647var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12675var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12874var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12908var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 13054var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 13082var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 13520var type = ((VariableDeclarationSyntax)decl.Parent).Type; 13584var type = ((VariableDeclarationSyntax)decl.Parent).Type; 13661var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 13731var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 14428var type = ((VariableDeclarationSyntax)decls[0].Parent).Type; 14470var type = ((VariableDeclarationSyntax)decls[0].Parent).Type; 14674var type = decl.Type; 14922var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 14950var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 15213var type = decl.Type; 27673var type = ((VariableDeclarationSyntax)decl.Parent).Type; 27763var type = ((VariableDeclarationSyntax)decl.Parent).Type; 28034var type = ((VariableDeclarationSyntax)decl.Parent).Type; 28094var type = ((VariableDeclarationSyntax)decl.Parent).Type; 28316var type = ((VariableDeclarationSyntax)decls[0].Parent).Type; 28364var type = ((VariableDeclarationSyntax)decls[0].Parent).Type;
Semantics\RefLocalsAndReturnsTests.cs (1)
5208var type = decl.Type;
Semantics\TypeOfTests.cs (1)
34var identifierName = node.Type;
Semantics\UnsafeTests.cs (1)
11307var typeSyntax = arrayTypeSyntax.ElementType;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (80)
Compilation\SemanticModelAPITests.cs (17)
534var bbase = bdecl.BaseList.Types[0].Type as TypeSyntax; 560var cbase = cdecl.BaseList.Types[0].Type as TypeSyntax; 586var cbase = cdecl.BaseList.Types[0].Type as TypeSyntax; 609var bbase = bdecl.BaseList.Types[0].Type as TypeSyntax; // A<T> 644var program = staticProgramField.Declaration.Type; 675var type = field.Declaration.Type; 703var type = method.ParameterList.Parameters[0].Type; 729TypeSyntax speculate = SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("A")); 2693TypeSyntax speculatedTypeSyntax, 3254var typeSyntax = SyntaxFactory.ParseTypeName("System.Collections.Generic.IEnumerable<C[]>"); 4359var typeSyntax = SyntaxFactory.ParseTypeName("dynamic"); 4509var varNode = declarationExpression.Type; 4573var varNode = declarationExpression.Type;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (4)
2427var type = localDecl.Declaration.Type; 2459var type = localDecl.Declaration.Type; 2563var type = methodDecl.ReturnType; 4000var typeofArgSyntax = typeofSyntax.Type;
Compilation\SemanticModelGetSemanticInfoTests.cs (1)
7260var semanticInfo = GetSemanticInfoForTest<TypeSyntax>(sourceCode);
DocumentationComments\CrefTests.cs (8)
5745var parameterType = cref.Parameters.Parameters.Single().Type; 6106var returnTypeSyntax = ((ConversionOperatorMemberCrefSyntax)(((QualifiedCrefSyntax)crefSyntax).Member)).Type; 6144var parameterTypeSyntax = ((NameMemberCrefSyntax)crefSyntax).Parameters.Parameters[0].Type; 6187var parameterTypeSyntax = crefSyntax.DescendantNodes().OfType<CrefParameterSyntax>().Single().Type; 6274var crefName = cref.Name; 6324var crefReturnType = cref.Type; 6325var crefParameterType = cref.Parameters.Parameters.Single().Type; 6638var name = ((GenericNameSyntax)crefSyntax.Name).TypeArgumentList.Arguments.Single();
Symbols\FunctionPointerTypeSymbolTests.cs (3)
51var paramType = syntaxTree.GetRoot() 684var paramType = syntaxTree.GetRoot() 1318var baseNameSyntax = syntaxTree.GetRoot()
Symbols\Source\FileModifierTests.cs (1)
4124var voidTypeSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single().Type!;
Symbols\Source\NullablePublicAPITests.cs (22)
2563var type = ((DeclarationExpressionSyntax)variable.Parent).Type; 4240var type = SyntaxFactory.ParseTypeName("string"); 4362var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4367var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4390var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4395var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4418var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4425var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4448var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4455var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4478var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4485var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4508var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4517var type2 = methodDeclaration.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4540var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4550var type2 = methodDeclaration.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4573var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4578var type2 = arrow.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4601var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4608var type2 = arrow.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4639var type2 = newInitializer.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4672var type2 = newInitializer.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
Symbols\Source\UsingAliasTests.cs (24)
41var base1 = a1.BaseList.Types[0].Type; 42var base2 = a2.BaseList.Types[0].Type; 43var base3 = a3.BaseList.Types[0].Type; 44var base4 = a4.BaseList.Types[0].Type; 98var base1 = a1.BaseList.Types[0].Type; 99var base2 = a2.BaseList.Types[0].Type; 100var base3 = a3.BaseList.Types[0].Type; 101var base4 = a4.BaseList.Types[0].Type; 158var base1 = a1.BaseList.Types[0].Type; 159var base2 = a2.BaseList.Types[0].Type; 160var base3 = a3.BaseList.Types[0].Type; 161var base4 = a4.BaseList.Types[0].Type; 213var base1 = a1.BaseList.Types[0].Type; 214var base2 = a2.BaseList.Types[0].Type; 215var base3 = a3.BaseList.Types[0].Type; 216var base4 = a4.BaseList.Types[0].Type; 305var base1 = a1.BaseList.Types[0].Type; 306var base2 = a2.BaseList.Types[0].Type; 307var base3 = a3.BaseList.Types[0].Type; 308var base4 = a4.BaseList.Types[0].Type; 351var base1 = a1.BaseList.Types[0].Type; 352var base2 = a2.BaseList.Types[0].Type; 353var base3 = a3.BaseList.Types[0].Type; 354var base4 = a4.BaseList.Types[0].Type;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (44)
Generated\Syntax.Test.xml.Generated.cs (6)
10373=> SyntaxFactory.TypeArgumentList(SyntaxFactory.Token(SyntaxKind.LessThanToken), new SeparatedSyntaxList<TypeSyntax>(), SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 10535=> SyntaxFactory.ParenthesizedLambdaExpression(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), default(TypeSyntax), GenerateParameterList(), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default(BlockSyntax), default(ExpressionSyntax)); 10583=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default(TypeSyntax), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.InKeyword), GenerateIdentifierName()); 10589=> SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), default(TypeSyntax), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.InKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.OnKeyword), GenerateIdentifierName(), SyntaxFactory.Token(SyntaxKind.EqualsKeyword), GenerateIdentifierName(), default(JoinIntoClauseSyntax)); 10637=> SyntaxFactory.RecursivePattern(default(TypeSyntax), default(PositionalPatternClauseSyntax), default(PropertyPatternClauseSyntax), default(VariableDesignationSyntax)); 10964=> SyntaxFactory.IncompleteMember(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), default(TypeSyntax));
IncrementalParsing\ChangingIdentifiers.cs (1)
276var nameTree = method.ReturnType;
LexicalAndXml\XmlDocCommentTests.cs (5)
1834var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 1869var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 1904var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as PropertyDeclarationSyntax).Type; 1939var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as IndexerDeclarationSyntax).Type; 2049var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType;
Parsing\NameParsingTests.cs (21)
24private TypeSyntax ParseTypeName(string text) 332var tname = ParseTypeName(text); 346var tname = ParseTypeName(text); 360var tname = ParseTypeName(text); 377var tname = ParseTypeName(text); 396var tname = ParseTypeName(text); 438var tname = ParseTypeName(text); 474var tname = ParseTypeName(text); 487var tname = ParseTypeName(text); 502var tname = ParseTypeName(text); 517var tname = ParseTypeName(text); 543var tname = ParseTypeName(text); 565var tname = ParseTypeName(text); 587var tname = ParseTypeName(text); 630var arg = gname.TypeArgumentList.Arguments[0]; 655var arg = gname.TypeArgumentList.Arguments[0]; 681var arg = gname.TypeArgumentList.Arguments[0]; 708var arg = gname.TypeArgumentList.Arguments[0]; 714var arg2 = gname.TypeArgumentList.Arguments[1]; 739var arg = gname.TypeArgumentList.Arguments[0]; 764var arg = gname.TypeArgumentList.Arguments[0];
Syntax\SyntaxFactoryTests.cs (3)
626var parsedWith8 = SyntaxFactory.ParseTypeName(type, options: TestOptions.Regular8); 629var parsedWithPreview = SyntaxFactory.ParseTypeName(type, options: TestOptions.Regular9); 714var typeName = SyntaxFactory.ParseTypeName("", options: parseOptions);
Syntax\SyntaxNodeTests.cs (8)
1928: SyntaxFactory.SingletonSeparatedList<TypeSyntax>(SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword))); 3591SyntaxFactory.SingletonSeparatedList<TypeSyntax>(intType); 3592SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken }); 3593SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, intType }); 3594SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, intType, commaToken }); 3596Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { commaToken })); 3597Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, commaToken })); 3598Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, intType }));
Microsoft.CodeAnalysis.CSharp.Test.Utilities (3)
FunctionPointerUtilities.cs (3)
243var paramSyntax = paramSyntaxes[i].Type!; 248var returnParam = paramSyntaxes[^1].Type; 252static void assertEqualSemanticInformation(SemanticModel model, TypeSyntax typeSyntax, ITypeSymbol signatureType)
Microsoft.CodeAnalysis.CSharp.Workspaces (177)
CodeGeneration\CSharpSyntaxGenerator.cs (46)
180(TypeSyntax)type, 198(TypeSyntax?)type, 240returnType: returnType != null ? (TypeSyntax)returnType : SyntaxFactory.PredefinedType(VoidKeyword), 266var returnTypeNode = returnType != null ? (TypeSyntax)returnType : SyntaxFactory.PredefinedType(VoidKeyword); 418(TypeSyntax)type, 510(TypeSyntax)type, 547(TypeSyntax)type, 578(TypeSyntax)type, 713baseTypes.Add(SyntaxFactory.SimpleBaseType((TypeSyntax)baseType)); 716baseTypes.AddRange(interfaceTypes.Select(i => SyntaxFactory.SimpleBaseType((TypeSyntax)i))); 764var itypes = interfaceTypes?.Select(i => (BaseTypeSyntax)SyntaxFactory.SimpleBaseType((TypeSyntax)i)).ToList(); 785var itypes = interfaceTypes?.Select(i => (BaseTypeSyntax)SyntaxFactory.SimpleBaseType((TypeSyntax)i)).ToList(); 892underlyingType != null ? SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)underlyingType)]) : null, 940returnType != null ? (TypeSyntax)returnType : SyntaxFactory.PredefinedType(VoidKeyword), 1842? SyntaxFactory.SeparatedList<TypeParameterConstraintSyntax>(types.Select(t => SyntaxFactory.TypeConstraint((TypeSyntax)t))) 2147private static TypeSyntax? NotVoid(TypeSyntax type) 2156SyntaxKind.DelegateDeclaration => ((DelegateDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 2157SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 2158SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).WithDeclaration(((FieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2159SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2160SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2161SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).WithDeclaration(((EventFieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2162SyntaxKind.EventDeclaration => ((EventDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2163SyntaxKind.Parameter => ((ParameterSyntax)declaration).WithType((TypeSyntax)type), 2164SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(((LocalDeclarationStatementSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2165SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2826return WithBaseList(declaration, baseList.WithTypes(baseList.Types.Insert(0, SyntaxFactory.SimpleBaseType((TypeSyntax)baseType)))); 2830return AddBaseList(declaration, SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)baseType)])); 2840return WithBaseList(declaration, baseList.WithTypes(baseList.Types.Insert(baseList.Types.Count, SyntaxFactory.SimpleBaseType((TypeSyntax)interfaceType)))); 2844return AddBaseList(declaration, SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)interfaceType)])); 3321var arrayType = SyntaxFactory.ArrayType((TypeSyntax)elementType, [SyntaxFactory.ArrayRankSpecifier([(ExpressionSyntax)size])]); 3327var arrayType = SyntaxFactory.ArrayType((TypeSyntax)elementType, 3334=> SyntaxFactory.ObjectCreationExpression((TypeSyntax)type, CreateArgumentList(arguments), null); 3338(TypeSyntax)type, 3364=> SyntaxFactory.BinaryExpression(SyntaxKind.IsExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression), (TypeSyntax)type); 3367=> SyntaxFactory.TypeOfExpression((TypeSyntax)type); 3370=> SyntaxFactory.BinaryExpression(SyntaxKind.AsExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression), (TypeSyntax)type); 3458SyntaxFactory.TypeArgumentList([.. typeArguments.Cast<TypeSyntax>()])); 3466return SyntaxFactory.GenericName(sname.Identifier, SyntaxFactory.TypeArgumentList([.. typeArguments.Cast<TypeSyntax>()])); 3470return gname.WithTypeArgumentList(SyntaxFactory.TypeArgumentList([.. typeArguments.Cast<TypeSyntax>()])); 3524=> SyntaxFactory.ArrayType((TypeSyntax)type, [SyntaxFactory.ArrayRankSpecifier()]); 3534return SyntaxFactory.NullableType((TypeSyntax)type); 3542=> SyntaxFactory.TupleElement((TypeSyntax)type, name?.ToIdentifierToken() ?? default); 3589SyntaxFactory.CatchDeclaration((TypeSyntax)type, name.ToIdentifierToken()),
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (3)
137ArrayBuilder<string> builder, TypeSyntax type, 597private static string GetTypeName(TypeSyntax type) 655if (node is TypeSyntax typeNode)
Rename\CSharpRenameRewriterLanguageService.cs (2)
1137if (enclosingNameMemberCrefOrnull != null && token.Parent is TypeSyntax && token.Parent.Parent is TypeSyntax)
Simplification\CSharpSimplificationService.Expander.cs (5)
187var typeSyntax = parameterSymbols[i].Type.GenerateTypeSyntax().WithTrailingTrivia(s_oneWhitespaceSeparator); 226var typeSyntax = parameterSymbol.Type.GenerateTypeSyntax().WithTrailingTrivia(s_oneWhitespaceSeparator); 394var rewrittenname = (TypeSyntax)this.Visit(node.Name); 766foreach (var typeArgument in castedTypeArgument.Arguments)
Simplification\Reducers\CSharpVarReducer.Rewriter.cs (1)
23private SyntaxNode ProcessTypeSyntax(TypeSyntax typeSyntax)
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (2)
371protected static TypeSyntax CreatePredefinedTypeSyntax(SyntaxNode nodeToReplace, SyntaxToken token) 373TypeSyntax node = token.Kind() == SyntaxKind.IdentifierToken
Simplification\Simplifiers\ExpressionSimplifier.cs (4)
54if (TryReduceExplicitName(expression, semanticModel, out var replacementTypeNode, out issueSpan, options, cancellationToken)) 66[NotNullWhen(true)] out TypeSyntax? replacementNode, 89[NotNullWhen(true)] out TypeSyntax? replacementNode, 186.WithAdditionalAnnotations<TypeSyntax>(new SyntaxAnnotation(
Simplification\Simplifiers\NameSimplifier.cs (10)
25internal sealed class NameSimplifier : AbstractCSharpSimplifier<NameSyntax, TypeSyntax> 37out TypeSyntax replacementNode, 188out var replacementNodeWithoutAttributeSuffix, 287var oldType = genericName.TypeArgumentList.Arguments.First(); 370NameSyntax name, TypeSyntax replacement, 461out TypeSyntax replacementNode, 487out TypeSyntax replacementNode, 579NameSyntax name, TypeSyntax reducedName, SemanticModel semanticModel) 614private static bool CanReplaceWithReducedName(NameSyntax name, TypeSyntax reducedName, SemanticModel semanticModel, CancellationToken cancellationToken) 625private static bool IsNotNullableReplaceable(NameSyntax name, TypeSyntax reducedName)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
202public static bool IsPredefinedType(TypeSyntax type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
42var typeSyntax = GetTypeSyntax(equalsValueClause); 67private static TypeSyntax GetTypeSyntax(EqualsValueClauseSyntax equalsValueClause)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
606while (topExpression.Parent is TypeSyntax typeSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (1)
150public static TypeSyntax GetMemberType(this MemberDeclarationSyntax member)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (5)
185TypeSyntax type, 319TypeSyntax type, 344private static TypeSyntax GetOutermostType(TypeSyntax type) 345=> type.GetAncestorsOrThis<TypeSyntax>().Last();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (5)
13public static bool IsVoid(this TypeSyntax typeSyntax) 17public static bool IsPartial(this TypeSyntax typeSyntax) 26public static bool IsTypeInferred(this TypeSyntax typeSyntax, SemanticModel semanticModel) 52public static TypeSyntax StripRefIfNeeded(this TypeSyntax type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\VariableDeclaratorExtensions.cs (2)
13public static TypeSyntax GetVariableType(this VariableDeclaratorSyntax declarator) 25var variableTypeName = variable.GetVariableType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
758var type = memberDeclaration.GetMemberType(); 1477=> node is TypeSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (2)
117var xArg = x.TypeArgumentList.Arguments[i]; 118var yArg = y.TypeArgumentList.Arguments[i];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (3)
32TypeSyntax, 96=> node is StatementSyntax(kind: not SyntaxKind.Block) or TypeSyntax or CrefSyntax || 141if (nodeToSpeculate is TypeSyntax typeNode)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (4)
35TypeSyntax typeName, SemanticModel semanticModel, 54TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 57SyntaxToken identifier, TypeSyntax typeName, ExpressionSyntax initializer, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 59internal TypeSyntax? FindAnalyzableType(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (3)
109var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 148var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 155private static TypeSyntax? GetTypeSyntaxFromDeclaration(SyntaxNode declarationStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (3)
60TypeSyntax typeName, SemanticModel semanticModel, 135TypeSyntax typeName, 149private static bool ContainsAnonymousType(TypeSyntax typeName, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
30TypeSyntax typeName, SemanticModel semanticModel, 50var type = variableDeclaration.Type.StripRefIfNeeded(); 61var type = forEachStatement.Type.StripRefIfNeeded(); 92TypeSyntax typeName, SemanticModel semanticModel, 174var declarationTypeNode = declarationExpression.Type; 241TypeSyntax typeName,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (5)
11: IComparer<TypeSyntax?> 16public int Compare(TypeSyntax? x, TypeSyntax? y) 41private static TypeSyntax UnwrapType(TypeSyntax type)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
783TypeSyntax newTypeSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
158private static TypeSyntax GenerateTypeSyntax(IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (2)
283if (expr is TypeSyntax) 493targetToken.GetPreviousToken(includeSkipped: true).IsLastTokenOfNode<TypeSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (11)
950{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 1516if (leftToken.IsLastTokenOfNode<TypeSyntax>(out var typeSyntax)) 1521while (typeSyntax.Parent is TypeSyntax parentTypeSyntax) 2326if (binary.Left is TypeSyntax type && type.IsPotentialTypeName(semanticModel, cancellationToken)) 2347var type = previousToken.Parent as TypeSyntax; 2353var underlyingType = type is PointerTypeSyntax pointerType 2387return conditionalExpression.Condition is not TypeSyntax type 2848var type = token.GetAncestors<TypeSyntax>().LastOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
115var typeSyntax = targetType.GenerateTypeSyntax();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (7)
33public static TypeSyntax GenerateTypeSyntax(this INamespaceOrTypeSymbol symbol, bool allowVar = true) 36private static TypeSyntax GenerateTypeSyntax( 47var syntax = containsAnonymousType 71public static TypeSyntax GenerateRefTypeSyntax( 74var underlyingType = GenerateTypeSyntax(symbol, allowVar) 81public static TypeSyntax GenerateRefReadOnlyTypeSyntax( 84var underlyingType = GenerateTypeSyntax(symbol, allowVar)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
43if (!_nameOnly && TypeSyntaxGeneratorVisitor.TryCreateNativeIntegerType(symbol, out var typeSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (24)
22private sealed class TypeSyntaxGeneratorVisitor(bool nameOnly) : SymbolVisitor<TypeSyntax> 39public override TypeSyntax DefaultVisit(ISymbol node) 43where TTypeSyntax : TypeSyntax 51public override TypeSyntax VisitAlias(IAliasSymbol symbol) 62public override TypeSyntax VisitArrayType(IArrayTypeSymbol symbol) 92var elementTypeSyntax = underlyingType.GenerateTypeSyntax(); 104TypeSyntax arrayTypeSyntax = ArrayType(elementTypeSyntax, [.. ranks]); 114public override TypeSyntax VisitDynamicType(IDynamicTypeSymbol symbol) 122public static bool TryCreateNativeIntegerType(INamedTypeSymbol symbol, [NotNullWhen(true)] out TypeSyntax? syntax) 134public override TypeSyntax VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 178public TypeSyntax CreateSimpleTypeSyntax(INamedTypeSymbol symbol) 182var syntax = TryCreateSpecializedNamedTypeSyntax(symbol); 204? Enumerable.Repeat((TypeSyntax)OmittedTypeArgument(), symbol.TypeArguments.Length) 218private static TypeSyntax? TryCreateSpecializedNamedTypeSyntax(INamedTypeSymbol symbol) 257public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol) 259if (TryCreateNativeIntegerType(symbol, out var typeSyntax)) 271var containingTypeSyntax = symbol.ContainingType.Accept(this); 295var container = symbol.ContainingNamespace.Accept(this)!; 312public override TypeSyntax VisitNamespace(INamespaceSymbol symbol) 326var container = symbol.ContainingNamespace.Accept(this)!; 337private static TypeSyntax AddGlobalAlias(INamespaceOrTypeSymbol symbol, SimpleNameSyntax syntax) 345public override TypeSyntax VisitPointerType(IPointerTypeSymbol symbol) 354public override TypeSyntax VisitTypeParameter(ITypeParameterSymbol symbol) 356TypeSyntax typeSyntax = AddInformationTo(symbol.Name.ToIdentifierName(), symbol);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
16public static bool IsPotentialTypeName([NotNullWhen(true)] this TypeSyntax? typeSyntax, SemanticModel? semanticModelOpt, CancellationToken cancellationToken) 55public static TypeSyntax GenerateReturnTypeSyntax(this IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (1)
57var type = declarationStatement.Declaration.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (7)
79type == null ? SyntaxFactory.IdentifierName("var") : (TypeSyntax)type, 248=> SyntaxFactory.TypePattern((TypeSyntax)type); 256=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)ParenthesizeNonSimple(expression)).WithAdditionalAnnotations(Simplifier.Annotation); 259=> SyntaxFactory.DefaultExpression((TypeSyntax)type).WithAdditionalAnnotations(Simplifier.Annotation); 298var type = typeSymbol.GenerateTypeSyntax(); 323if (expression is TypeSyntax || 349=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)ParenthesizeNonSimple(expression)).WithAdditionalAnnotations(Simplifier.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2174var variableType = variableDeclarator.GetVariableType();
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (28)
CodeGeneration\AddImportsTests.cs (1)
47root = root.ReplaceNodes(root.DescendantNodesAndSelf().OfType<TypeSyntax>(),
CodeGeneration\SyntaxGeneratorTests.cs (27)
290VerifySyntax<TypeSyntax>(Generator.IdentifierName("x"), "x"); 291VerifySyntax<TypeSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 292VerifySyntax<TypeSyntax>(Generator.DottedName("x.y"), "x.y"); 293VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 294VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 296VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.IdentifierName("x")), "x[]"); 297VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.ArrayTypeExpression(Generator.IdentifierName("x"))), "x[][]"); 298VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.IdentifierName("x")), "x?"); 299VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.NullableTypeExpression(Generator.IdentifierName("x"))), "x?"); 306VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(Generator.TupleElementExpression(Generator.IdentifierName("x")), Generator.TupleElementExpression(Generator.IdentifierName("y"))), "(x, y)"); 307VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }), "(global::System.Int32, global::System.Int32)"); 308VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }, ["x", "y"]), "(global::System.Int32 x, global::System.Int32 y)"); 314VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Byte), "byte"); 315VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_SByte), "sbyte"); 317VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int16), "short"); 318VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt16), "ushort"); 320VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int32), "int"); 321VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt32), "uint"); 323VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int64), "long"); 324VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt64), "ulong"); 326VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Single), "float"); 327VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Double), "double"); 329VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Char), "char"); 330VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_String), "string"); 332VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Object), "object"); 333VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Decimal), "decimal"); 5286VerifySyntax<TypeSyntax>(
Microsoft.DotNet.GenAPI (5)
CSharpAssemblyDocumentGenerator.cs (2)
300TypeSyntax typeSyntaxNode = (TypeSyntax)_syntaxGenerator.TypeExpression(symbol.MakeUnboundIfGeneric());
SyntaxGeneratorExtensions.cs (3)
121TypeSyntax baseTypeSyntax = (TypeSyntax)syntaxGenerator.TypeExpression(type.BaseType); 136.Select(i => SyntaxFactory.SimpleBaseType((TypeSyntax)syntaxGenerator.TypeExpression(i))));
Microsoft.Interop.ComInterfaceGenerator (4)
Marshallers\ObjectUnwrapperResolver.cs (2)
13internal sealed record ObjectUnwrapperInfo(TypeSyntax UnwrapperType) : MarshallingInfo; 37TypeSyntax unwrapperType = ((ObjectUnwrapperInfo)info.MarshallingAttributeInfo).UnwrapperType;
VirtualMethodPointerStubGenerator.cs (1)
149(ParameterListSyntax unmanagedParameterList, TypeSyntax returnType, _) = stubGenerator.GenerateAbiMethodSignatureData();
VtableIndexStubGenerator.cs (1)
305var unwrapperSyntax = ParseTypeName(unmanagedObjectUnwrapper.AttributeClass.TypeArguments[0].ToDisplayString());
Microsoft.Interop.JavaScript.JSImportGenerator (7)
JSImportGenerator.cs (1)
315TypeSyntax jsMarshalerArgument = ParseTypeName(Constants.JSMarshalerArgumentGlobal);
JSManagedTypeInfo.cs (2)
179public JSSimpleTypeInfo(KnownManagedType knownType, TypeSyntax syntax) 184public TypeSyntax Syntax { get; init; }
Marshaling\FuncJSGenerator.cs (2)
93private static ArgumentSyntax ArgToJS(int i, TypeSyntax sourceType, MarshalerType marshalerType) => Argument(ParenthesizedLambdaExpression() 108private static ArgumentSyntax ArgToManaged(int i, TypeSyntax sourceType, MarshalerType marshalerType) => Argument(ParenthesizedLambdaExpression()
Marshaling\TaskJSGenerator.cs (2)
68private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source, TypeSyntax sourceType) 91private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source, TypeSyntax sourceType)
Microsoft.Interop.LibraryImportGenerator (1)
LibraryImportGenerator.cs (1)
453(ParameterListSyntax parameterList, TypeSyntax returnType, AttributeListSyntax returnTypeAttributes) = stubGenerator.GenerateTargetMethodSignatureData();
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
DownlevelLibraryImportGenerator.cs (1)
317(ParameterListSyntax parameterList, TypeSyntax returnType, AttributeListSyntax returnTypeAttributes) = stubGenerator.GenerateTargetMethodSignatureData();
Microsoft.Interop.SourceGeneration (99)
BoundGenerators.cs (1)
205public (ParameterListSyntax ParameterList, TypeSyntax ReturnType, AttributeListSyntax? ReturnTypeAttributes) GenerateTargetMethodSignatureData(StubIdentifierContext context)
ManagedToNativeStubGenerator.cs (1)
196public (ParameterListSyntax ParameterList, TypeSyntax ReturnType, AttributeListSyntax? ReturnTypeAttributes) GenerateTargetMethodSignatureData()
ManagedTypeInfo.cs (2)
15private TypeSyntax? _syntax; 16public TypeSyntax Syntax => _syntax ??= SyntaxFactory.ParseTypeName(FullTypeName);
Marshalling\AttributedMarshallingModelGeneratorResolver.cs (9)
242TypeSyntax unmanagedElementType = elementMarshaller.NativeType.Syntax.GetCompatibleGenericTypeParameterSyntax(); 244TypeSyntax marshallerTypeSyntax = ReplacePlaceholderSyntaxWithUnmanagedTypeSyntax(marshallerType.Syntax, marshalInfo, unmanagedElementType); 266TypeSyntax bufferElementTypeSyntax = marshallerData.BufferElementType.Syntax.IsEquivalentTo(marshalInfo.PlaceholderTypeParameter.Syntax) 312TypeSyntax bufferElementTypeSyntax = marshallerData.BufferElementType.Syntax.IsEquivalentTo(marshalInfo.PlaceholderTypeParameter.Syntax) 392private static ElementsMarshalling CreateElementsMarshalling(CustomTypeMarshallerData marshallerData, IBoundMarshallingGenerator elementMarshaller, TypeSyntax unmanagedElementType, IElementsMarshallingCollectionSource collectionSource) 409private static TypeSyntax ReplacePlaceholderSyntaxWithUnmanagedTypeSyntax( 410TypeSyntax originalTypeSyntax, 412TypeSyntax unmanagedElementType) 414originalTypeSyntax.DescendantNodesAndSelf().OfType<TypeSyntax>().Where(t => t.IsEquivalentTo(marshalInfo.PlaceholderTypeParameter.Syntax)),
Marshalling\ElementsMarshalling.cs (3)
145TypeSyntax managedElementType, 146TypeSyntax unmanagedElementType, 251TypeSyntax unmanagedElementType,
Marshalling\MarshallerHelpers.cs (4)
16public static readonly TypeSyntax SystemIntPtrType = TypeSyntaxes.System_IntPtr; 30public static TypeSyntax GetCompatibleGenericTypeParameterSyntax(this TypeSyntax type) 32TypeSyntax spanElementTypeSyntax = type;
Marshalling\MarshallingGeneratorExtensions.cs (1)
20public static TypeSyntax AsReturnType(this IBoundMarshallingGenerator generator)
Marshalling\StatefulMarshallingStrategy.cs (2)
184internal sealed class StatefulCallerAllocatedBufferMarshalling(ICustomTypeMarshallingStrategy innerMarshaller, TypeSyntax marshallerType, TypeSyntax bufferElementType) : ICustomTypeMarshallingStrategy
Marshalling\StatelessMarshallingStrategy.cs (6)
17internal sealed class StatelessValueMarshalling(TypePositionInfo info, StubCodeContext codeContext, TypeSyntax marshallerTypeSyntax, ManagedTypeInfo unmanagedType, MarshallerShape shape) : ICustomTypeMarshallingStrategy 147internal sealed class StatelessCallerAllocatedBufferMarshalling(ICustomTypeMarshallingStrategy innerMarshaller, TypeSyntax marshallerType, TypeSyntax bufferElementType, bool isLinearCollectionMarshalling) : ICustomTypeMarshallingStrategy 247internal sealed class StatelessFreeMarshalling(ICustomTypeMarshallingStrategy innerMarshaller, TypeSyntax marshallerType) : ICustomTypeMarshallingStrategy 308internal sealed class StatelessLinearCollectionSpaceAllocator(TypePositionInfo info, StubCodeContext codeContext, TypeSyntax marshallerTypeSyntax, ManagedTypeInfo unmanagedType, MarshallerShape shape, CountInfo countInfo, bool countInfoRequiresCast) : ICustomTypeMarshallingStrategy 476internal sealed class StatelessLinearCollectionSource(TypePositionInfo info, StubCodeContext codeContext, TypeSyntax marshallerTypeSyntax) : IElementsMarshallingCollectionSource
Marshalling\StaticPinnableManagedValueMarshaller.cs (1)
13public sealed class StaticPinnableManagedValueMarshaller(IBoundMarshallingGenerator innerMarshallingGenerator, TypeSyntax getPinnableReferenceType) : IBoundMarshallingGenerator
SignatureContext.cs (1)
34public TypeSyntax StubReturnType { get; init; }
TypeNames.cs (61)
57public static TypeSyntax Void { get; } = PredefinedType(Token(SyntaxKind.VoidKeyword)); 59public static TypeSyntax VoidStar { get; } = PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword))); 61public static TypeSyntax VoidStarStar { get; } = PointerType(PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword)))); 63public static TypeSyntax Nint { get; } = ParseTypeName(TypeNames.Nint); 65private static TypeSyntax? _StringMarshalling; 66public static TypeSyntax StringMarshalling => _StringMarshalling ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.StringMarshalling); 68private static TypeSyntax? _System_Runtime_InteropServices_ComWrappers_ComInterfaceEntry; 69public static TypeSyntax System_Runtime_InteropServices_ComWrappers_ComInterfaceEntry => _System_Runtime_InteropServices_ComWrappers_ComInterfaceEntry ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_ComWrappers_ComInterfaceEntry); 71private static TypeSyntax? _System_Runtime_InteropServices_NativeMemory; 72public static TypeSyntax System_Runtime_InteropServices_NativeMemory => _System_Runtime_InteropServices_NativeMemory ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_NativeMemory); 74private static TypeSyntax? _StrategyBasedComWrappers; 75public static TypeSyntax StrategyBasedComWrappers => _StrategyBasedComWrappers ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.StrategyBasedComWrappers); 77private static TypeSyntax? _IUnmanagedVirtualMethodTableProvider; 78public static TypeSyntax IUnmanagedVirtualMethodTableProvider => _IUnmanagedVirtualMethodTableProvider ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.IUnmanagedVirtualMethodTableProvider); 80private static TypeSyntax? _IIUnknownInterfaceType; 81public static TypeSyntax IIUnknownInterfaceType => _IIUnknownInterfaceType ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.IIUnknownInterfaceType); 83private static TypeSyntax? _IIUnknownDerivedDetails; 84public static TypeSyntax IIUnknownDerivedDetails => _IIUnknownDerivedDetails ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.IIUnknownDerivedDetails); 86private static TypeSyntax? _UnmanagedObjectUnwrapper; 87public static TypeSyntax UnmanagedObjectUnwrapper => _UnmanagedObjectUnwrapper ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.UnmanagedObjectUnwrapper); 89private static TypeSyntax? _IComExposedClass; 90public static TypeSyntax IComExposedClass => _IComExposedClass ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.IComExposedClass); 92private static TypeSyntax? _UnreachableException; 93public static TypeSyntax UnreachableException => _UnreachableException ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.UnreachableException); 95private static TypeSyntax? _System_Runtime_CompilerServices_RuntimeHelpers; 96public static TypeSyntax System_Runtime_CompilerServices_RuntimeHelpers => _System_Runtime_CompilerServices_RuntimeHelpers ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_CompilerServices_RuntimeHelpers); 98private static TypeSyntax? _System_Runtime_InteropServices_ComWrappers; 99public static TypeSyntax System_Runtime_InteropServices_ComWrappers => _System_Runtime_InteropServices_ComWrappers ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_ComWrappers); 101private static TypeSyntax? _System_IntPtr; 102public static TypeSyntax System_IntPtr => _System_IntPtr ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_IntPtr); 104private static TypeSyntax? _System_Guid; 105public static TypeSyntax System_Guid => _System_Guid ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Guid); 107private static TypeSyntax? _DllImportSearchPath; 108public static TypeSyntax DllImportSearchPath => _DllImportSearchPath ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.DllImportSearchPath); 110private static TypeSyntax? _System_Type; 111public static TypeSyntax System_Type => _System_Type ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Type); 113private static TypeSyntax? _System_Activator; 114public static TypeSyntax System_Activator => _System_Activator ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Activator); 116private static TypeSyntax? _System_Runtime_InteropServices_Marshal; 117public static TypeSyntax System_Runtime_InteropServices_Marshal => _System_Runtime_InteropServices_Marshal ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_Marshal); 119private static TypeSyntax? _System_Runtime_InteropServices_UnmanagedType; 120public static TypeSyntax System_Runtime_InteropServices_UnmanagedType => _System_Runtime_InteropServices_UnmanagedType ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_UnmanagedType); 122private static TypeSyntax? _System_Runtime_InteropServices_MemoryMarshal; 123public static TypeSyntax System_Runtime_InteropServices_MemoryMarshal => _System_Runtime_InteropServices_MemoryMarshal ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_MemoryMarshal); 125private static TypeSyntax? _System_Exception; 126public static TypeSyntax System_Exception => _System_Exception ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Exception); 128private static TypeSyntax? _System_GC; 129public static TypeSyntax System_GC => _System_GC ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_GC); 131private static TypeSyntax? _System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch; 132public static TypeSyntax System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch => _System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch); 134private static TypeSyntax? _System_Runtime_CompilerServices_Unsafe; 135public static TypeSyntax System_Runtime_CompilerServices_Unsafe => _System_Runtime_CompilerServices_Unsafe ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_CompilerServices_Unsafe); 137private static TypeSyntax? _System_Runtime_InteropServices_LayoutKind; 138public static TypeSyntax System_Runtime_InteropServices_LayoutKind => _System_Runtime_InteropServices_LayoutKind ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_LayoutKind); 140private static TypeSyntax? _CallConvCdecl; 141private static TypeSyntax? _CallConvFastcall; 142private static TypeSyntax? _CallConvMemberFunction; 143private static TypeSyntax? _CallConvStdcall; 144private static TypeSyntax? _CallConvSuppressGCTransition; 145private static TypeSyntax? _CallConvThiscall; 146public static TypeSyntax CallConv(string callConv)
TypeSymbolExtensions.cs (1)
170public static TypeSyntax AsTypeSyntax(this ITypeSymbol type)
UnmanagedToManagedStubGenerator.cs (1)
108public (ParameterListSyntax ParameterList, TypeSyntax ReturnType, AttributeListSyntax? ReturnTypeAttributes) GenerateAbiMethodSignatureData()
Utils\SyntaxFactoryExtensions.cs (4)
18public static LocalDeclarationStatementSyntax Declare(TypeSyntax typeSyntax, string identifier, bool initializeToDefault) 28public static LocalDeclarationStatementSyntax Declare(TypeSyntax typeSyntax, string identifier, ExpressionSyntax? initializer) 81public static GenericNameSyntax SpanOf(TypeSyntax type) => GenericName(_span, TypeArgumentList(SingletonSeparatedList(type))); 84public static GenericNameSyntax ReadOnlySpanOf(TypeSyntax type) => GenericName(_readonlySpan, TypeArgumentList(SingletonSeparatedList(type)));
VariableDeclarations.cs (1)
146TypeSyntax localType = marshaller.NativeType.Syntax;
Microsoft.VisualStudio.LanguageServices.CSharp (13)
CodeModel\CSharpCodeModelService.CodeModelEventCollector.cs (5)
145if (oldExpression is TypeSyntax typeSyntax) 147return CompareTypes(typeSyntax, (TypeSyntax)newExpression); 774private bool CompareTypes(TypeSyntax oldType, TypeSyntax newType) 828private static TypeSyntax GetReturnType(BaseMethodDeclarationSyntax method)
CodeModel\CSharpCodeModelService.cs (6)
971var typeName = SyntaxFactory.ParseTypeName(name); 2723TypeSyntax? oldType; 2743var newType = SyntaxFactory.ParseTypeName(typeName); 3015var parsedTypeName = SyntaxFactory.ParseTypeName(partialName); 3026var parsedTypeName = SyntaxFactory.ParseTypeName(fullName); 3699var typeName = SyntaxFactory.ParseTypeName(typeSymbol.ToMinimalDisplayString(semanticModel, position));
CodeModel\CSharpCodeModelService.NodeNameGenerator.cs (1)
58private static void AppendTypeName(StringBuilder builder, TypeSyntax type)
CodeModel\MethodXml\MethodXmlBuilder.cs (1)
142private bool TryGenerateType(TypeSyntax type)
Roslyn.Diagnostics.CSharp.Analyzers (106)
CSharpExposeMemberForTesting.cs (1)
48return SyntaxFactory.RefType(refKeyword, readOnlyKeyword, (TypeSyntax)type);
PreferNullLiteralCodeFixProvider.cs (1)
56var type = defaultExpression.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
202public static bool IsPredefinedType(TypeSyntax type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
42var typeSyntax = GetTypeSyntax(equalsValueClause); 67private static TypeSyntax GetTypeSyntax(EqualsValueClauseSyntax equalsValueClause)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
606while (topExpression.Parent is TypeSyntax typeSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (1)
150public static TypeSyntax GetMemberType(this MemberDeclarationSyntax member)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (5)
185TypeSyntax type, 319TypeSyntax type, 344private static TypeSyntax GetOutermostType(TypeSyntax type) 345=> type.GetAncestorsOrThis<TypeSyntax>().Last();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (5)
13public static bool IsVoid(this TypeSyntax typeSyntax) 17public static bool IsPartial(this TypeSyntax typeSyntax) 26public static bool IsTypeInferred(this TypeSyntax typeSyntax, SemanticModel semanticModel) 52public static TypeSyntax StripRefIfNeeded(this TypeSyntax type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\VariableDeclaratorExtensions.cs (2)
13public static TypeSyntax GetVariableType(this VariableDeclaratorSyntax declarator) 25var variableTypeName = variable.GetVariableType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
758var type = memberDeclaration.GetMemberType(); 1477=> node is TypeSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (2)
117var xArg = x.TypeArgumentList.Arguments[i]; 118var yArg = y.TypeArgumentList.Arguments[i];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (3)
32TypeSyntax, 96=> node is StatementSyntax(kind: not SyntaxKind.Block) or TypeSyntax or CrefSyntax || 141if (nodeToSpeculate is TypeSyntax typeNode)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (4)
35TypeSyntax typeName, SemanticModel semanticModel, 54TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 57SyntaxToken identifier, TypeSyntax typeName, ExpressionSyntax initializer, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 59internal TypeSyntax? FindAnalyzableType(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (3)
109var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 148var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 155private static TypeSyntax? GetTypeSyntaxFromDeclaration(SyntaxNode declarationStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (3)
60TypeSyntax typeName, SemanticModel semanticModel, 135TypeSyntax typeName, 149private static bool ContainsAnonymousType(TypeSyntax typeName, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
30TypeSyntax typeName, SemanticModel semanticModel, 50var type = variableDeclaration.Type.StripRefIfNeeded(); 61var type = forEachStatement.Type.StripRefIfNeeded(); 92TypeSyntax typeName, SemanticModel semanticModel, 174var declarationTypeNode = declarationExpression.Type; 241TypeSyntax typeName,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (5)
11: IComparer<TypeSyntax?> 16public int Compare(TypeSyntax? x, TypeSyntax? y) 41private static TypeSyntax UnwrapType(TypeSyntax type)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
783TypeSyntax newTypeSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
158private static TypeSyntax GenerateTypeSyntax(IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (2)
283if (expr is TypeSyntax) 493targetToken.GetPreviousToken(includeSkipped: true).IsLastTokenOfNode<TypeSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (11)
950{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 1516if (leftToken.IsLastTokenOfNode<TypeSyntax>(out var typeSyntax)) 1521while (typeSyntax.Parent is TypeSyntax parentTypeSyntax) 2326if (binary.Left is TypeSyntax type && type.IsPotentialTypeName(semanticModel, cancellationToken)) 2347var type = previousToken.Parent as TypeSyntax; 2353var underlyingType = type is PointerTypeSyntax pointerType 2387return conditionalExpression.Condition is not TypeSyntax type 2848var type = token.GetAncestors<TypeSyntax>().LastOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
115var typeSyntax = targetType.GenerateTypeSyntax();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (7)
33public static TypeSyntax GenerateTypeSyntax(this INamespaceOrTypeSymbol symbol, bool allowVar = true) 36private static TypeSyntax GenerateTypeSyntax( 47var syntax = containsAnonymousType 71public static TypeSyntax GenerateRefTypeSyntax( 74var underlyingType = GenerateTypeSyntax(symbol, allowVar) 81public static TypeSyntax GenerateRefReadOnlyTypeSyntax( 84var underlyingType = GenerateTypeSyntax(symbol, allowVar)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
43if (!_nameOnly && TypeSyntaxGeneratorVisitor.TryCreateNativeIntegerType(symbol, out var typeSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (24)
22private sealed class TypeSyntaxGeneratorVisitor(bool nameOnly) : SymbolVisitor<TypeSyntax> 39public override TypeSyntax DefaultVisit(ISymbol node) 43where TTypeSyntax : TypeSyntax 51public override TypeSyntax VisitAlias(IAliasSymbol symbol) 62public override TypeSyntax VisitArrayType(IArrayTypeSymbol symbol) 92var elementTypeSyntax = underlyingType.GenerateTypeSyntax(); 104TypeSyntax arrayTypeSyntax = ArrayType(elementTypeSyntax, [.. ranks]); 114public override TypeSyntax VisitDynamicType(IDynamicTypeSymbol symbol) 122public static bool TryCreateNativeIntegerType(INamedTypeSymbol symbol, [NotNullWhen(true)] out TypeSyntax? syntax) 134public override TypeSyntax VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 178public TypeSyntax CreateSimpleTypeSyntax(INamedTypeSymbol symbol) 182var syntax = TryCreateSpecializedNamedTypeSyntax(symbol); 204? Enumerable.Repeat((TypeSyntax)OmittedTypeArgument(), symbol.TypeArguments.Length) 218private static TypeSyntax? TryCreateSpecializedNamedTypeSyntax(INamedTypeSymbol symbol) 257public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol) 259if (TryCreateNativeIntegerType(symbol, out var typeSyntax)) 271var containingTypeSyntax = symbol.ContainingType.Accept(this); 295var container = symbol.ContainingNamespace.Accept(this)!; 312public override TypeSyntax VisitNamespace(INamespaceSymbol symbol) 326var container = symbol.ContainingNamespace.Accept(this)!; 337private static TypeSyntax AddGlobalAlias(INamespaceOrTypeSymbol symbol, SimpleNameSyntax syntax) 345public override TypeSyntax VisitPointerType(IPointerTypeSymbol symbol) 354public override TypeSyntax VisitTypeParameter(ITypeParameterSymbol symbol) 356TypeSyntax typeSyntax = AddInformationTo(symbol.Name.ToIdentifierName(), symbol);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
16public static bool IsPotentialTypeName([NotNullWhen(true)] this TypeSyntax? typeSyntax, SemanticModel? semanticModelOpt, CancellationToken cancellationToken) 55public static TypeSyntax GenerateReturnTypeSyntax(this IMethodSymbol method)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (1)
57var type = declarationStatement.Declaration.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (7)
79type == null ? SyntaxFactory.IdentifierName("var") : (TypeSyntax)type, 248=> SyntaxFactory.TypePattern((TypeSyntax)type); 256=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)ParenthesizeNonSimple(expression)).WithAdditionalAnnotations(Simplifier.Annotation); 259=> SyntaxFactory.DefaultExpression((TypeSyntax)type).WithAdditionalAnnotations(Simplifier.Annotation); 298var type = typeSymbol.GenerateTypeSyntax(); 323if (expression is TypeSyntax || 349=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)ParenthesizeNonSimple(expression)).WithAdditionalAnnotations(Simplifier.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2174var variableType = variableDeclarator.GetVariableType();
System.Text.RegularExpressions.Generator (3)
UpgradeToGeneratedRegexCodeFixer.cs (3)
149(TypeSyntax)generator.TypeExpression(regexSymbol), 193(TypeSyntax)generator.TypeExpression(regexSymbol), SyntaxFactory.Identifier(variableDeclarator.Identifier.ValueText).WithAdditionalAnnotations(RenameAnnotation.Create())) 243(TypeSyntax)generator.TypeExpression(regexSymbol), SyntaxFactory.Identifier(propertyDeclaration.Identifier.ValueText))