1047 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 (186)
Binder\Binder.WithQueryLambdaParametersBinder.cs (1)
99var result = BindMemberOfType(node, node, name, 0, indexed: false, receiver, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), lookupResult, BoundMethodGroupFlags.None, diagnostics);
Binder\Binder_Await.cs (1)
372var qualified = BindInstanceMemberAccess(node, node, receiver, name, 0, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), invoked: false, indexed: false, diagnostics);
Binder\Binder_Conversions.cs (1)
1302typeArgumentsSyntax: default(SeparatedSyntaxList<TypeSyntax>),
Binder\Binder_Crefs.cs (4)
81private NamespaceOrTypeSymbol BindNamespaceOrTypeSymbolInCref(TypeSyntax syntax) 886SeparatedSyntaxList<TypeSyntax> typeArgumentSyntaxes = typeArgumentListSyntax.Arguments; 898TypeSyntax typeArgumentSyntax = typeArgumentSyntaxes[i]; 954private TypeSymbol BindCrefParameterOrReturnType(TypeSyntax typeSyntax, MemberCrefSyntax memberCrefSyntax, BindingDiagnosticBag diagnostics)
Binder\Binder_Deconstruct.cs (4)
654typeArgumentsSyntax: default(SeparatedSyntaxList<TypeSyntax>), 820TypeSyntax typeSyntax = declExpr.Type; 877TypeSyntax typeSyntax = declExpr.Type; 928TypeSyntax typeSyntax = declExpr.Type;
Binder\Binder_Expressions.cs (13)
1584SeparatedSyntaxList<TypeSyntax> typeArgumentList = node.Kind() == SyntaxKind.GenericName 1586: default(SeparatedSyntaxList<TypeSyntax>); 3109TypeSyntax typeSyntax = declarationExpression.Type; 3151TypeSyntax typeSyntax = declarationExpression.Type; 4445TypeSyntax typeSyntax = node.Type; 7538SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? 7540default(SeparatedSyntaxList<TypeSyntax>); 7587/// <see cref="MakeQueryInvocation(CSharpSyntaxNode, BoundExpression, string, TypeSyntax, TypeWithAnnotations, BindingDiagnosticBag, string)"/>. 7661var typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? ((GenericNameSyntax)right).TypeArgumentList.Arguments : default(SeparatedSyntaxList<TypeSyntax>); 7757SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, 7831SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, 7927SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, 8225SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax,
Binder\Binder_Invocation.cs (2)
83SeparatedSyntaxList<TypeSyntax> typeArgsSyntax = default(SeparatedSyntaxList<TypeSyntax>),
Binder\Binder_Lambda.cs (1)
280private (RefKind, TypeWithAnnotations) BindExplicitLambdaReturnType(TypeSyntax syntax, BindingDiagnosticBag diagnostics)
Binder\Binder_Patterns.cs (6)
843TypeSyntax typeSyntax = node.Type; 852TypeSyntax typeSyntax, 869TypeSyntax? typeSyntax, 927TypeSyntax? typeSyntax, 972TypeSyntax? typeSyntax = node.Type; 1555typeArgumentsSyntax: default(SeparatedSyntaxList<TypeSyntax>),
Binder\Binder_Query.cs (6)
842private UnboundLambda MakeQueryUnboundLambdaWithCast(RangeVariableMap qvm, RangeVariableSymbol parameter, ExpressionSyntax expression, TypeSyntax castTypeSyntax, TypeWithAnnotations castType, bool withDependencies) 880return MakeQueryInvocation(node, receiver, methodName, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), ImmutableArray.Create(arg), diagnostics 893return MakeQueryInvocation(node, receiver, methodName, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), args, diagnostics 900protected BoundCall MakeQueryInvocation(CSharpSyntaxNode node, BoundExpression receiver, string methodName, TypeSyntax typeArgSyntax, TypeWithAnnotations typeArg, BindingDiagnosticBag diagnostics 906return MakeQueryInvocation(node, receiver, methodName, new SeparatedSyntaxList<TypeSyntax>(new SyntaxNodeOrTokenList(typeArgSyntax, 0)), ImmutableArray.Create(typeArg), ImmutableArray<BoundExpression>.Empty, diagnostics 913protected BoundCall MakeQueryInvocation(CSharpSyntaxNode node, BoundExpression receiver, string methodName, SeparatedSyntaxList<TypeSyntax> typeArgsSyntax, ImmutableArray<TypeWithAnnotations> typeArgs, ImmutableArray<BoundExpression> args, BindingDiagnosticBag diagnostics
Binder\Binder_Statements.cs (5)
784private TypeWithAnnotations BindVariableTypeWithAnnotations(CSharpSyntaxNode declarationNode, BindingDiagnosticBag diagnostics, TypeSyntax typeSyntax, ref bool isConst, out bool isVar, out AliasSymbol alias) 951TypeSyntax typeSyntax, 977TypeSyntax typeSyntax, 1194private SourceLocalSymbol LocateDeclaredVariableSymbol(VariableDeclaratorSyntax declarator, TypeSyntax typeSyntax, LocalDeclarationKind outerKind) 1200private SourceLocalSymbol LocateDeclaredVariableSymbol(SyntaxToken identifier, TypeSyntax typeSyntax, EqualsValueClauseSyntax equalsValue, LocalDeclarationKind kind)
Binder\Binder_Symbols.cs (16)
37internal TypeWithAnnotations BindTypeOrVarKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out bool isVar) 57private TypeWithAnnotations BindTypeOrConstraintKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out ConstraintContextualKeyword keyword) 78internal TypeWithAnnotations BindTypeOrVarKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out bool isVar, out AliasSymbol alias) 107private NamespaceOrTypeOrAliasSymbolWithAnnotations BindTypeOrAliasOrVarKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out bool isVar) 134private NamespaceOrTypeOrAliasSymbolWithAnnotations BindTypeOrAliasOrConstraintKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out ConstraintContextualKeyword keyword) 184/// PREREQUISITE: syntax should be checked to match the keyword, like <see cref="TypeSyntax.IsVar"/> or <see cref="TypeSyntax.IsUnmanaged"/>. 469return BindTypeArgument((TypeSyntax)syntax, diagnostics, basesBeingResolved); 542TypeSyntax typeArgumentSyntax = nullableSyntax.ElementType; 1204SeparatedSyntaxList<TypeSyntax> typeArguments = node.TypeArgumentList.Arguments; 1337private ImmutableArray<TypeWithAnnotations> BindTypeArguments(SeparatedSyntaxList<TypeSyntax> typeArguments, BindingDiagnosticBag diagnostics, ConsList<TypeSymbol> basesBeingResolved = null) 1341foreach (var argSyntax in typeArguments) 1349private TypeWithAnnotations BindTypeArgument(TypeSyntax typeArgument, BindingDiagnosticBag diagnostics, ConsList<TypeSymbol> basesBeingResolved = null) 1372private NamedTypeSymbol ConstructNamedTypeUnlessTypeArgumentOmitted(SyntaxNode typeSyntax, NamedTypeSymbol type, SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, ImmutableArray<TypeWithAnnotations> typeArguments, BindingDiagnosticBag diagnostics) 1417SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, 1571SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax,
Binder\ExpressionVariableFinder.cs (7)
287protected abstract TFieldOrLocalSymbol MakePatternVariable(TypeSyntax type, SingleVariableDesignationSyntax designation, SyntaxNode nodeToBind); 496TypeSyntax closestTypeSyntax, 539TypeSyntax closestTypeSyntax, 592protected override LocalSymbol MakePatternVariable(TypeSyntax type, SingleVariableDesignationSyntax designation, SyntaxNode nodeToBind) 641TypeSyntax closestTypeSyntax, 705protected override Symbol MakePatternVariable(TypeSyntax type, SingleVariableDesignationSyntax designation, SyntaxNode nodeToBind) 722TypeSyntax closestTypeSyntax,
Binder\ForEachLoopBinder.cs (2)
139TypeSyntax closestTypeSyntax, 282TypeSyntax typeSyntax = node.Type;
Binder\ForLoopBinder.cs (1)
75var type = _syntax.Declaration.Type.SkipScoped(out _);
Binder\LocalBinderFactory.cs (1)
55private 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)
78private void AddTypeParameters(TypeSyntax typeSyntax, MultiDictionary<string, TypeParameterSymbol> map) 119SeparatedSyntaxList<TypeSyntax> typeArguments = genericNameSyntax.TypeArgumentList.Arguments;
BoundTree\VariablePendingInference.cs (1)
70(typeOrDesignationSyntax is TypeSyntax typeSyntax ? typeSyntax.SkipScoped(out _).SkipRef() : typeOrDesignationSyntax).Location);
Compilation\CSharpSemanticModel.cs (8)
163/// then the provided expression should be a <see cref="TypeSyntax"/>.</param> 210if (!(expression is TypeSyntax)) 256Debug.Assert(bindingOption != SpeculativeBindingOption.BindAsTypeOrNamespace || expression is TypeSyntax); 309else if (expression is TypeSyntax typeSyntax) 543if (((TypeSyntax)expression).IsVar) 973if (((TypeSyntax)expression).IsVar) 2565public bool TryGetSpeculativeSemanticModel(int position, TypeSyntax type, out SemanticModel speculativeModel, SpeculativeBindingOption bindingOption = SpeculativeBindingOption.BindAsExpression) 2573internal abstract bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, TypeSyntax type, SpeculativeBindingOption bindingOption, out PublicSemanticModel speculativeModel);
Compilation\MemberSemanticModel.cs (2)
169internal sealed override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, TypeSyntax type, SpeculativeBindingOption bindingOption, out PublicSemanticModel speculativeModel) 1510Debug.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, 555internal 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)
1150public 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\ConstraintsHelper.cs (1)
673SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, // may be omitted in synthesized invocations
Symbols\Source\GlobalExpressionVariable.cs (6)
31TypeSyntax typeSyntax, 44TypeSyntax typeSyntax, 60protected override TypeSyntax TypeSyntax => (TypeSyntax)_typeSyntaxOpt?.GetSyntax(); 79var typeSyntax = TypeSyntax; 170TypeSyntax typeSyntax,
Symbols\Source\LocalFunctionSymbol.cs (1)
251TypeSyntax returnTypeSyntax = Syntax.ReturnType;
Symbols\Source\SourceDelegateMethodSymbol.cs (1)
52TypeSyntax returnTypeSyntax = syntax.ReturnType;
Symbols\Source\SourceEventSymbol.cs (1)
738protected TypeWithAnnotations BindEventType(Binder binder, TypeSyntax typeSyntax, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceLocalSymbol.cs (11)
34private readonly TypeSyntax _typeSyntax; 46TypeSyntax typeSyntax, 111TypeSyntax typeSyntax, 139TypeSyntax closestTypeSyntax, 159TypeSyntax typeSyntax, 205TypeSyntax typeSyntax, 319TypeSyntax typeSyntax = _typeSyntax.SkipScoped(out _).SkipRef(); 527TypeSyntax typeSyntax, 628TypeSyntax typeSyntax, 669TypeSyntax typeSyntax, 733TypeSyntax typeSyntax,
Symbols\Source\SourceMemberFieldSymbol.cs (3)
43protected abstract TypeSyntax TypeSyntax { get; } 377protected sealed override TypeSyntax TypeSyntax 488var typeOnly = typeSyntax.SkipScoped(out _).SkipRefInField(out refKind);
Symbols\Source\SourceMethodSymbol.cs (1)
31protected static void ReportBadRefToken(TypeSyntax returnTypeSyntax, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceNamedTypeSymbol.cs (1)
60TypeSyntax t = baseTypeSyntax.Type;
Symbols\Source\SourcePropertySymbol.cs (2)
172private TypeSyntax GetTypeSyntax(SyntaxNode syntax) => ((BasePropertyDeclarationSyntax)syntax).Type; 563var typeSyntax = GetTypeSyntax(syntax);
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (1)
219protected (TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymbol> Parameters) MakeParametersAndBindReturnType(BaseMethodDeclarationSyntax declarationSyntax, TypeSyntax returnTypeSyntax, BindingDiagnosticBag diagnostics)
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)
1706public static TypeSyntax ParseTypeName(string text, int offset, bool consumeFullText) 1714public static TypeSyntax ParseTypeName(string text, int offset = 0, ParseOptions? options = null, bool consumeFullText = true) 1721return (TypeSyntax)node.CreateRed(); 2064internal static TypeSyntax? GetStandaloneType(TypeSyntax? node) 2453TypeSyntax type, 2474TypeSyntax type, 2495TypeSyntax type, 2518TypeSyntax type, 2541TypeSyntax type, 2565TypeSyntax returnType, 2588TypeSyntax returnType, 2613TypeSyntax returnType, 2634TypeSyntax returnType, 2709public static EventDeclarationSyntax EventDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList) 2715public static EventDeclarationSyntax EventDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, SyntaxToken semicolonToken) 2846public 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)
684if (token.Parent.IsKind(SyntaxKind.ConditionalExpression) || token.Parent is TypeSyntax)
Microsoft.CodeAnalysis.CSharp.CodeStyle (65)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
61var typeSyntax = declarationPattern.Type;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
280n => n is TypeSyntax or
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (4)
61private static bool IsLanguageRestrictedToNonNullForm(TypeSyntax node) 103static TypeSyntax WalkUpCurrentQualifiedName(TypeSyntax node) 124if (node is TypeSyntax typeSyntax
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
75Right: TypeSyntax whereTypeSyntax 94[NotNullWhen(true)] out TypeSyntax? caseOrSelectType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
741Func<TArrayCreationExpressionSyntax, TypeSyntax> getType,
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (2)
137TypeSyntax typeNode, 221private static bool IsViableTupleTypeSyntax(TypeSyntax type)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
84TypeSyntax? typeNode;
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)
203public 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)
607while (topExpression.Parent is TypeSyntax typeSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (1)
138public static TypeSyntax GetMemberType(this MemberDeclarationSyntax member)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (5)
185TypeSyntax type, 320TypeSyntax type, 345private static TypeSyntax GetOutermostType(TypeSyntax type) 346=> 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)
772var type = memberDeclaration.GetMemberType(); 1573=> node is TypeSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1437var originalMemberType = originalMemberSymbol.GetMemberType(); 1438var rewrittenMemberType = rewrittenMemberSymbol.GetMemberType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (2)
119var xArg = x.TypeArgumentList.Arguments[i]; 120var 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 (6)
18private readonly TypeSyntax _typeName; 38public TypeStyleResult(CSharpTypeStyleHelper helper, TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, bool isStylePreferred, NotificationOption2 notificationOption, CancellationToken cancellationToken) : this() 59TypeSyntax typeName, SemanticModel semanticModel, 77TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 80SyntaxToken identifier, TypeSyntax typeName, ExpressionSyntax initializer, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 82internal TypeSyntax? FindAnalyzableType(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (3)
94var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 133var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 140private static TypeSyntax? GetTypeSyntaxFromDeclaration(SyntaxNode declarationStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (2)
67TypeSyntax typeName, SemanticModel semanticModel, 139TypeSyntax typeName,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
30TypeSyntax typeName, SemanticModel semanticModel, 50var type = variableDeclaration.Type.StripRefIfNeeded(); 61var type = forEachStatement.Type.StripRefIfNeeded(); 98TypeSyntax typeName, SemanticModel semanticModel, 188var declarationTypeNode = declarationExpression.Type; 255TypeSyntax typeName,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (5)
10internal class TypeSyntaxComparer : IComparer<TypeSyntax?> 21public int Compare(TypeSyntax? x, TypeSyntax? y) 46private static TypeSyntax UnwrapType(TypeSyntax type)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (109)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
111var type = cannotUseVar ? declaratorToRemoveType!.GenerateTypeSyntax() : IdentifierName("var");
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (6)
57static bool IsVoid(TypeSyntax typeSyntax) 61private static async Task<(TypeSyntax declarationToFix, TypeSyntax fixedDeclaration)> TryGetOldAndNewReturnTypeAsync( 88TypeSyntax fixedDeclaration; 135private static (TypeSyntax type, bool isAsync) TryGetDeclarationTypeToFix(SyntaxNode node) 139static (TypeSyntax type, bool isAsync) TryGetReturnTypeToFix(SyntaxNode containingMember)
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (1)
43var node = semanticDocument.Root.FindToken(textSpan.Start).GetAncestor<TypeSyntax>();
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (4)
91foreach (var type in genericName.TypeArgumentList.Arguments) 108TypeSyntax type, 116private ITypeParameterSymbol GetMethodTypeParameter(TypeSyntax type, CancellationToken cancellationToken) 156foreach (var typeArgument in genericName.TypeArgumentList.Arguments)
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceCodeFixProvider.cs (2)
19: AbstractImplementInterfaceCodeFixProvider<TypeSyntax> 28protected override bool IsTypeInInterfaceBaseList(TypeSyntax type)
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
47if (node is TypeSyntax interfaceNode && interfaceNode.Parent is BaseTypeSyntax baseType &&
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
231var explicitType = declaration.Type.IsVar ? local.Type?.GenerateTypeSyntax() : declaration.Type; 254public static TypeSyntax GenerateTypeSyntaxOrVar( 282TypeSyntax newType, VariableDeclaratorSyntax declaratorOpt)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
73var newReturnType = ienumerableGenericSymbol.GenerateTypeSyntax();
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (6)
112private static TypeSyntax FixMethodReturnType( 115TypeSyntax returnTypeSyntax, 119var newReturnType = returnTypeSyntax.WithAdditionalAnnotations(Formatter.Annotation); 157static TypeSyntax MakeGenericType(string type, ITypeSymbol typeArgumentFrom) 180private static (SyntaxTokenList newModifiers, TypeSyntax newReturnType) AddAsyncModifierWithCorrectedTrivia(SyntaxTokenList modifiers, TypeSyntax returnType)
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (3)
56private static TypeSyntax FixMethodReturnType(IMethodSymbol methodSymbol, TypeSyntax returnTypeSyntax, KnownTaskTypes knownTypes) 58var newReturnType = returnTypeSyntax;
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
187var newType = await Simplifier.ExpandAsync(usingDirective.NamespaceOrType, document, cancellationToken: cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (8)
81using var _ = PooledHashSet<TypeSyntax>.GetInstance(out var alreadyHandled); 100Document document, SemanticModel model, SyntaxEditor editor, SyntaxNode node, HashSet<TypeSyntax> alreadyHandled, CancellationToken cancellationToken) 111private static async Task<TypeSyntax?> TryGetDeclarationTypeToFixAsync( 270static TypeSyntax? TryGetReturnType(TypeSyntax returnType, SyntaxTokenList modifiers, bool onYield) 284static TypeSyntax? TryGetSingleTypeArgument(TypeSyntax type) 302static TypeSyntax? TryGetParameterTypeSyntax(IParameterSymbol? parameterSymbol, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (3)
12internal static SyntaxNode WithoutAsyncModifier(MethodDeclarationSyntax method, TypeSyntax returnType) 18internal static SyntaxNode WithoutAsyncModifier(LocalFunctionStatementSyntax localFunction, TypeSyntax returnType) 33private static SyntaxTokenList RemoveAsyncModifier(SyntaxTokenList modifiers, ref TypeSyntax newReturnType)
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)
148private ExpressionSyntax CreateTupleOrDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode) 159private 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 (5)
85var typeSyntax = declarationExpression.Type; 132TypeSyntax typeSyntax, 190var typeName = type.GenerateTypeSyntax(allowVar: false); 216private static SyntaxNode GenerateTypeDeclaration(TypeSyntax typeSyntax, ITypeSymbol newTypeSymbol) 220var newTypeSyntax = newTypeSymbol
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (3)
40var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 47internal static void ReplaceTypeWithVar(SyntaxEditor editor, TypeSyntax type)
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (2)
37private static readonly TypeSyntax s_objectType = PredefinedType(ObjectKeyword); 215var 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)
62editor.ReplaceNode(typeArgumentList, typeArgumentList.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) 494targetToken.GetPreviousToken(includeSkipped: true).IsLastTokenOfNode<TypeSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (9)
949{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 1515if (leftToken.IsLastTokenOfNode<TypeSyntax>(out var typeSyntax)) 1520while (typeSyntax.Parent is TypeSyntax parentTypeSyntax) 2325if (binary.Left is TypeSyntax type && type.IsPotentialTypeName(semanticModel, cancellationToken)) 2346var type = previousToken.Parent as TypeSyntax; 2352var underlyingType = type is PointerTypeSyntax pointerType 2386return conditionalExpression.Condition is not TypeSyntax type 2845var type = token.GetAncestors<TypeSyntax>().LastOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
119var typeSyntax = targetType.GenerateTypeSyntax();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (5)
33public static TypeSyntax GenerateTypeSyntax(this INamespaceOrTypeSymbol symbol, bool allowVar = true) 36private static TypeSyntax GenerateTypeSyntax( 49var syntax = containsAnonymousType 74public static TypeSyntax GenerateRefTypeSyntax( 84public static TypeSyntax GenerateRefReadOnlyTypeSyntax(
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 class TypeSyntaxGeneratorVisitor : SymbolVisitor<TypeSyntax> 35public override TypeSyntax DefaultVisit(ISymbol node) 39where TTypeSyntax : TypeSyntax 47public override TypeSyntax VisitAlias(IAliasSymbol symbol) 58public override TypeSyntax VisitArrayType(IArrayTypeSymbol symbol) 88var elementTypeSyntax = underlyingType.GenerateTypeSyntax(); 100TypeSyntax arrayTypeSyntax = ArrayType(elementTypeSyntax, [.. ranks]); 110public override TypeSyntax VisitDynamicType(IDynamicTypeSymbol symbol) 118public static bool TryCreateNativeIntegerType(INamedTypeSymbol symbol, [NotNullWhen(true)] out TypeSyntax? syntax) 130public override TypeSyntax VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 174public TypeSyntax CreateSimpleTypeSyntax(INamedTypeSymbol symbol) 178var syntax = TryCreateSpecializedNamedTypeSyntax(symbol); 204? Enumerable.Repeat((TypeSyntax)OmittedTypeArgument(), symbol.TypeArguments.Length) 224private static TypeSyntax? TryCreateSpecializedNamedTypeSyntax(INamedTypeSymbol symbol) 263public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol) 265if (TryCreateNativeIntegerType(symbol, out var typeSyntax)) 277var containingTypeSyntax = symbol.ContainingType.Accept(this); 301var container = symbol.ContainingNamespace.Accept(this)!; 318public override TypeSyntax VisitNamespace(INamespaceSymbol symbol) 332var container = symbol.ContainingNamespace.Accept(this)!; 343private static TypeSyntax AddGlobalAlias(INamespaceOrTypeSymbol symbol, SimpleNameSyntax syntax) 351public override TypeSyntax VisitPointerType(IPointerTypeSymbol symbol) 360public override TypeSyntax VisitTypeParameter(ITypeParameterSymbol symbol) 362TypeSyntax 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 (2)
67type == null ? SyntaxFactory.IdentifierName("var") : (TypeSyntax)type, 236=> SyntaxFactory.TypePattern((TypeSyntax)type);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (2)
426var typeNode = objectCreationExpressionNode.Type; 441var newTypeNode = typeNode.WithoutTrivia();
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)
4037var type = refVar.Type; 4074var type = refVar.Type; 4108var type = refInt.Type;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (5)
Attributes\AttributeTests.cs (1)
7580var typeofArgSyntax = typeofSyntax.Type;
Semantics\OutVarTests.cs (1)
1036var typeSyntax = decl.Type;
Semantics\PatternMatchingTestBase.cs (3)
103var typeSyntax = decl.Type; 131private static void AssertTypeInfo(SemanticModel model, TypeSyntax typeSyntax, ITypeSymbol expectedType) 269var typeSyntax = decl.Type;
Microsoft.CodeAnalysis.CSharp.Features (137)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
145? additionalTypeParameters.Select(p => (TypeSyntax)p.Name.ToIdentifierName()).ToArray()
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
177var container = qualifiedCref.Container;
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (6)
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 (1)
80string? GetNewTypeName(TypeSyntax existingReturnType)
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (3)
76var typeNode = potentialTypeNode as TypeSyntax; 80if (typeNode.Parent is TypeSyntax parentType && parentType.Span.End < position)
Completion\CompletionProviders\OverrideCompletionProvider.cs (1)
54if (startToken.Parent is TypeSyntax typeSyntax)
Completion\KeywordRecommenders\CheckedKeywordRecommender.cs (2)
35if (previousPossiblySkippedToken.IsLastTokenOfNode<TypeSyntax>()) 46if (firstSpecifierToken.GetPreviousToken(includeSkipped: true).IsLastTokenOfNode<TypeSyntax>())
Completion\KeywordRecommenders\InKeywordRecommender.cs (2)
93var 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);
ConvertForToForEach\CSharpConvertForToForEachCodeRefactoringProvider.cs (2)
24TypeSyntax, 114TypeSyntax? typeNode,
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (2)
102AnalyzedPattern.Type p when feature.HasFlag(Feature.TypePattern) => TypePattern((TypeSyntax)p.IsExpressionSyntax.Right), 103AnalyzedPattern.Type p => DeclarationPattern((TypeSyntax)p.IsExpressionSyntax.Right, DiscardDesignation()),
ConvertLinq\ConvertForEachToLinqQuery\DefaultConverter.cs (1)
23private static readonly TypeSyntax VarNameIdentifier = IdentifierName("var");
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
33private static readonly TypeSyntax VarNameIdentifier = IdentifierName("var");
Debugging\DataTipInfoGetter.cs (1)
36else if (expression is TypeSyntax typeSyntax && typeSyntax.IsVar)
Diagnostics\Analyzers\CSharpPreferFrameworkTypeDiagnosticAnalyzer.cs (1)
18TypeSyntax,
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (2)
171else if (expression is ObjectCreationExpressionSyntax { Type: TypeSyntax exceptionType }) 184private static bool IsExceptionCaughtAndNotRethrown(bool hasUsingSystem, TypeSyntax exceptionType)
EditAndContinue\SyntaxComparer.cs (1)
970out TypeSyntax? returnType,
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (3)
187private SeparatedSyntaxList<TypeSyntax> CreateMethodCallTypeVariables() 499var typeSyntax = declarationStatement.Declaration.Type; 814TypeSyntax returnType,
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
156var parsedType = ParseTypeName(localText, startIndex, consumeFullText: false);
GenerateType\CSharpGenerateTypeService.cs (5)
57if (expression is TypeSyntax typeSyntax && expression.Parent is TypeArgumentListSyntax typeArgumentList) 87if (expression is TypeSyntax { Parent: BaseTypeSyntax { Parent: BaseListSyntax baseList } baseType } && 102if (expression is TypeSyntax { Parent: TypeConstraintSyntax { Parent: TypeParameterConstraintClauseSyntax constraintClause } typeConstraint }) 456state.NameOrMemberAccessExpression as TypeSyntax, cancellationToken); 465state.NameOrMemberAccessExpression as TypeSyntax, cancellationToken);
IntroduceVariable\CSharpIntroduceVariableService.cs (1)
23AbstractIntroduceVariableService<CSharpIntroduceVariableService, ExpressionSyntax, TypeSyntax, TypeDeclarationSyntax, QueryExpressionSyntax, NameSyntax>
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
210private 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)
69static (TypeSyntax iteratorTypeSyntax, SyntaxNode? inlineExpression) GetLoopHeaderParts(SyntaxGenerator generator, InlineExpressionInfo? inlineExpressionInfo, Compilation compilation)
Snippets\AbstractCSharpMainMethodSnippetProvider.cs (1)
16: 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)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
61var typeSyntax = declarationPattern.Type;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
280n => n is TypeSyntax or
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (4)
61private static bool IsLanguageRestrictedToNonNullForm(TypeSyntax node) 103static TypeSyntax WalkUpCurrentQualifiedName(TypeSyntax node) 124if (node is TypeSyntax typeSyntax
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
75Right: TypeSyntax whereTypeSyntax 94[NotNullWhen(true)] out TypeSyntax? caseOrSelectType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
741Func<TArrayCreationExpressionSyntax, TypeSyntax> getType,
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (2)
137TypeSyntax typeNode, 221private static bool IsViableTupleTypeSyntax(TypeSyntax type)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
84TypeSyntax? typeNode;
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\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (6)
57static bool IsVoid(TypeSyntax typeSyntax) 61private static async Task<(TypeSyntax declarationToFix, TypeSyntax fixedDeclaration)> TryGetOldAndNewReturnTypeAsync( 88TypeSyntax fixedDeclaration; 135private static (TypeSyntax type, bool isAsync) TryGetDeclarationTypeToFix(SyntaxNode node) 139static (TypeSyntax type, bool isAsync) TryGetReturnTypeToFix(SyntaxNode containingMember)
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (1)
43var node = semanticDocument.Root.FindToken(textSpan.Start).GetAncestor<TypeSyntax>();
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (4)
91foreach (var type in genericName.TypeArgumentList.Arguments) 108TypeSyntax type, 116private ITypeParameterSymbol GetMethodTypeParameter(TypeSyntax type, CancellationToken cancellationToken) 156foreach (var typeArgument in genericName.TypeArgumentList.Arguments)
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceCodeFixProvider.cs (2)
19: AbstractImplementInterfaceCodeFixProvider<TypeSyntax> 28protected override bool IsTypeInInterfaceBaseList(TypeSyntax type)
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
47if (node is TypeSyntax interfaceNode && interfaceNode.Parent is BaseTypeSyntax baseType &&
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (2)
254public static TypeSyntax GenerateTypeSyntaxOrVar( 282TypeSyntax newType, VariableDeclaratorSyntax declaratorOpt)
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (6)
112private static TypeSyntax FixMethodReturnType( 115TypeSyntax returnTypeSyntax, 119var newReturnType = returnTypeSyntax.WithAdditionalAnnotations(Formatter.Annotation); 157static TypeSyntax MakeGenericType(string type, ITypeSymbol typeArgumentFrom) 180private static (SyntaxTokenList newModifiers, TypeSyntax newReturnType) AddAsyncModifierWithCorrectedTrivia(SyntaxTokenList modifiers, TypeSyntax returnType)
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (3)
56private static TypeSyntax FixMethodReturnType(IMethodSymbol methodSymbol, TypeSyntax returnTypeSyntax, KnownTaskTypes knownTypes) 58var newReturnType = returnTypeSyntax;
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
187var newType = await Simplifier.ExpandAsync(usingDirective.NamespaceOrType, document, cancellationToken: cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (8)
81using var _ = PooledHashSet<TypeSyntax>.GetInstance(out var alreadyHandled); 100Document document, SemanticModel model, SyntaxEditor editor, SyntaxNode node, HashSet<TypeSyntax> alreadyHandled, CancellationToken cancellationToken) 111private static async Task<TypeSyntax?> TryGetDeclarationTypeToFixAsync( 270static TypeSyntax? TryGetReturnType(TypeSyntax returnType, SyntaxTokenList modifiers, bool onYield) 284static TypeSyntax? TryGetSingleTypeArgument(TypeSyntax type) 302static TypeSyntax? TryGetParameterTypeSyntax(IParameterSymbol? parameterSymbol, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (3)
12internal static SyntaxNode WithoutAsyncModifier(MethodDeclarationSyntax method, TypeSyntax returnType) 18internal static SyntaxNode WithoutAsyncModifier(LocalFunctionStatementSyntax localFunction, TypeSyntax returnType) 33private static SyntaxTokenList RemoveAsyncModifier(SyntaxTokenList modifiers, ref TypeSyntax newReturnType)
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)
148private ExpressionSyntax CreateTupleOrDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode) 159private static DeclarationExpressionSyntax CreateDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode)
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (3)
85var typeSyntax = declarationExpression.Type; 132TypeSyntax typeSyntax, 216private static SyntaxNode GenerateTypeDeclaration(TypeSyntax typeSyntax, ITypeSymbol newTypeSymbol)
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (3)
40var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 47internal static void ReplaceTypeWithVar(SyntaxEditor editor, TypeSyntax type)
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
37private static readonly TypeSyntax s_objectType = PredefinedType(ObjectKeyword);
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)
62editor.ReplaceNode(typeArgumentList, typeArgumentList.WithArguments(SeparatedList<TypeSyntax>(list)));
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (3)
124var type = (TypeSyntax)isExpression.Right; 224SyntaxFactory.DeclarationPattern((TypeSyntax)isExpression.Right.WithTrailingTrivia(SyntaxFactory.Space),
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (55)
Semantics\ArglistTests.cs (1)
963var type = stmt.Declaration.Type;
Semantics\ForEachTests.cs (1)
2894var varSyntax = foreachSyntax.Type;
Semantics\LambdaTests.cs (1)
5645var returnTypeSyntax = lambdaSyntax.ReturnType;
Semantics\NativeIntegerTests.cs (1)
4075var typeSyntax = SyntaxFactory.ParseTypeName("nuint");
Semantics\NullableContextTests.cs (1)
2229var type = SyntaxFactory.ParseTypeName(typeName);
Semantics\NullableReferenceTypesTests.cs (20)
10536var type1 = foreachSyntax[0].Type; 10540var type2 = foreachSyntax[1].Type; 113787TypeSyntax type = SyntaxFactory.ParseTypeName( 113796private static void AssertGetSpeculativeTypeInfo(string source, NullableContextOptions nullableContextOptions, TypeSyntax type, string expected) 113824TypeSyntax type = SyntaxFactory.ParseTypeName( 113849TypeSyntax type = SyntaxFactory.ParseTypeName( 113874TypeSyntax type = SyntaxFactory.ParseTypeName( 113903TypeSyntax type = SyntaxFactory.ParseTypeName( 113930TypeSyntax type = SyntaxFactory.ParseTypeName( 113958TypeSyntax type = SyntaxFactory.ParseTypeName( 113986TypeSyntax type = SyntaxFactory.ParseTypeName( 114012TypeSyntax type = SyntaxFactory.ParseTypeName( 114021private static void AssertTryGetSpeculativeSemanticModel(string source, NullableContextOptions nullableContextOptions, TypeSyntax type, string expected) 114050TypeSyntax type = SyntaxFactory.ParseTypeName( 114075TypeSyntax type = SyntaxFactory.ParseTypeName( 114100TypeSyntax type = SyntaxFactory.ParseTypeName( 114129TypeSyntax type = SyntaxFactory.ParseTypeName( 114156TypeSyntax type = SyntaxFactory.ParseTypeName( 114184TypeSyntax type = SyntaxFactory.ParseTypeName( 114212TypeSyntax type = SyntaxFactory.ParseTypeName(
Semantics\RefFieldTests.cs (27)
12073var type = ((VariableDeclarationSyntax)decl.Parent).Type; 12141var type = ((VariableDeclarationSyntax)decl.Parent).Type; 12207var type = ((VariableDeclarationSyntax)decl.Parent).Type; 12396var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12428var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12580var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12608var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12807var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12841var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 12987var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 13015var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 13453var type = ((VariableDeclarationSyntax)decl.Parent).Type; 13517var type = ((VariableDeclarationSyntax)decl.Parent).Type; 13594var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 13664var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 14361var type = ((VariableDeclarationSyntax)decls[0].Parent).Type; 14403var type = ((VariableDeclarationSyntax)decls[0].Parent).Type; 14607var type = decl.Type; 14855var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 14883var type = ((DeclarationExpressionSyntax)decl.Parent).Type; 15146var type = decl.Type; 27619var type = ((VariableDeclarationSyntax)decl.Parent).Type; 27709var type = ((VariableDeclarationSyntax)decl.Parent).Type; 27980var type = ((VariableDeclarationSyntax)decl.Parent).Type; 28040var type = ((VariableDeclarationSyntax)decl.Parent).Type; 28262var type = ((VariableDeclarationSyntax)decls[0].Parent).Type; 28310var type = ((VariableDeclarationSyntax)decls[0].Parent).Type;
Semantics\RefLocalsAndReturnsTests.cs (1)
5214var 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, 3223var typeSyntax = SyntaxFactory.ParseTypeName("System.Collections.Generic.IEnumerable<C[]>"); 4328var typeSyntax = SyntaxFactory.ParseTypeName("dynamic"); 4478var varNode = declarationExpression.Type; 4542var 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)
7261var semanticInfo = GetSemanticInfoForTest<TypeSyntax>(sourceCode);
DocumentationComments\CrefTests.cs (8)
5745var parameterType = cref.Parameters.Parameters.Single().Type; 6109var returnTypeSyntax = ((ConversionOperatorMemberCrefSyntax)(((QualifiedCrefSyntax)crefSyntax).Member)).Type; 6147var parameterTypeSyntax = ((NameMemberCrefSyntax)crefSyntax).Parameters.Parameters[0].Type; 6190var parameterTypeSyntax = crefSyntax.DescendantNodes().OfType<CrefParameterSyntax>().Single().Type; 6277var crefName = cref.Name; 6327var crefReturnType = cref.Type; 6328var crefParameterType = cref.Parameters.Parameters.Single().Type; 6674var name = ((GenericNameSyntax)crefSyntax.Name).TypeArgumentList.Arguments.Single();
Symbols\FunctionPointerTypeSymbolTests.cs (3)
51var paramType = syntaxTree.GetRoot() 684var paramType = syntaxTree.GetRoot() 1316var 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; 4243var type = SyntaxFactory.ParseTypeName("string"); 4365var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4370var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4393var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4398var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4421var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4428var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4451var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4458var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4481var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4488var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4511var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4520var type2 = methodDeclaration.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4543var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4553var type2 = methodDeclaration.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4576var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4581var type2 = arrow.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4604var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4611var type2 = arrow.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4642var type2 = newInitializer.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4675var 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 (7)
10239=> SyntaxFactory.TypeArgumentList(SyntaxFactory.Token(SyntaxKind.LessThanToken), new SeparatedSyntaxList<TypeSyntax>(), SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 10401=> SyntaxFactory.ParenthesizedLambdaExpression(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), default(TypeSyntax), GenerateParameterList(), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default(BlockSyntax), default(ExpressionSyntax)); 10449=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default(TypeSyntax), SyntaxFactory.Identifier("Identifier"), SyntaxFactory.Token(SyntaxKind.InKeyword), GenerateIdentifierName()); 10455=> 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)); 10503=> SyntaxFactory.RecursivePattern(default(TypeSyntax), default(PositionalPatternClauseSyntax), default(PropertyPatternClauseSyntax), default(VariableDesignationSyntax)); 10821=> SyntaxFactory.Parameter(new SyntaxList<AttributeListSyntax>(), new SyntaxTokenList(), default(TypeSyntax), SyntaxFactory.Identifier("Identifier"), default(EqualsValueClauseSyntax)); 10827=> 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 (2)
626var parsedWith8 = SyntaxFactory.ParseTypeName(type, options: TestOptions.Regular8); 629var parsedWithPreview = SyntaxFactory.ParseTypeName(type, options: TestOptions.Regular9);
Syntax\SyntaxNodeTests.cs (8)
1854: SyntaxFactory.SingletonSeparatedList<TypeSyntax>(SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword))); 3517SyntaxFactory.SingletonSeparatedList<TypeSyntax>(intType); 3518SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken }); 3519SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, intType }); 3520SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, intType, commaToken }); 3522Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { commaToken })); 3523Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, commaToken })); 3524Assert.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 (179)
CodeGeneration\CSharpSyntaxGenerator.cs (51)
184(TypeSyntax)type, 202(TypeSyntax?)type, 246returnType: returnType != null ? (TypeSyntax)returnType : SyntaxFactory.PredefinedType(VoidKeyword), 273var returnTypeNode = returnType != null ? (TypeSyntax)returnType : SyntaxFactory.PredefinedType(VoidKeyword); 414(TypeSyntax)type, 503(TypeSyntax)type, 540(TypeSyntax)type, 571(TypeSyntax)type, 706baseTypes.Add(SyntaxFactory.SimpleBaseType((TypeSyntax)baseType)); 709baseTypes.AddRange(interfaceTypes.Select(i => SyntaxFactory.SimpleBaseType((TypeSyntax)i))); 757var itypes = interfaceTypes?.Select(i => (BaseTypeSyntax)SyntaxFactory.SimpleBaseType((TypeSyntax)i)).ToList(); 778var itypes = interfaceTypes?.Select(i => (BaseTypeSyntax)SyntaxFactory.SimpleBaseType((TypeSyntax)i)).ToList(); 891underlyingType != null ? SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)underlyingType)]) : null, 939returnType != null ? (TypeSyntax)returnType : SyntaxFactory.PredefinedType(VoidKeyword), 1831? SyntaxFactory.SeparatedList<TypeParameterConstraintSyntax>(types.Select(t => SyntaxFactory.TypeConstraint((TypeSyntax)t))) 1975private static TypeSyntax? NotVoid(TypeSyntax type) 1984SyntaxKind.DelegateDeclaration => ((DelegateDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 1985SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 1986SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).WithDeclaration(((FieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 1987SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithType((TypeSyntax)type), 1988SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).WithType((TypeSyntax)type), 1989SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).WithDeclaration(((EventFieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 1990SyntaxKind.EventDeclaration => ((EventDeclarationSyntax)declaration).WithType((TypeSyntax)type), 1991SyntaxKind.Parameter => ((ParameterSyntax)declaration).WithType((TypeSyntax)type), 1992SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(((LocalDeclarationStatementSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 1993SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2657return WithBaseList(declaration, baseList.WithTypes(baseList.Types.Insert(0, SyntaxFactory.SimpleBaseType((TypeSyntax)baseType)))); 2661return AddBaseList(declaration, SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)baseType)])); 2671return WithBaseList(declaration, baseList.WithTypes(baseList.Types.Insert(baseList.Types.Count, SyntaxFactory.SimpleBaseType((TypeSyntax)interfaceType)))); 2675return AddBaseList(declaration, SyntaxFactory.BaseList([SyntaxFactory.SimpleBaseType((TypeSyntax)interfaceType)])); 3163if (expression is TypeSyntax || 3184var arrayType = SyntaxFactory.ArrayType((TypeSyntax)elementType, [SyntaxFactory.ArrayRankSpecifier([(ExpressionSyntax)size])]); 3190var arrayType = SyntaxFactory.ArrayType((TypeSyntax)elementType, 3197=> SyntaxFactory.ObjectCreationExpression((TypeSyntax)type, CreateArgumentList(arguments), null); 3201(TypeSyntax)type, 3224=> SyntaxFactory.DefaultExpression((TypeSyntax)type).WithAdditionalAnnotations(Simplifier.Annotation); 3265=> SyntaxFactory.BinaryExpression(SyntaxKind.IsExpression, (ExpressionSyntax)Parenthesize(expression), (TypeSyntax)type); 3268=> SyntaxFactory.TypeOfExpression((TypeSyntax)type); 3271=> SyntaxFactory.BinaryExpression(SyntaxKind.AsExpression, (ExpressionSyntax)Parenthesize(expression), (TypeSyntax)type); 3274=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)Parenthesize(expression)).WithAdditionalAnnotations(Simplifier.Annotation); 3277=> SyntaxFactory.CastExpression((TypeSyntax)type, (ExpressionSyntax)Parenthesize(expression)).WithAdditionalAnnotations(Simplifier.Annotation); 3371SyntaxFactory.TypeArgumentList([.. typeArguments.Cast<TypeSyntax>()])); 3379return SyntaxFactory.GenericName(sname.Identifier, SyntaxFactory.TypeArgumentList([.. typeArguments.Cast<TypeSyntax>()])); 3383return gname.WithTypeArgumentList(SyntaxFactory.TypeArgumentList([.. typeArguments.Cast<TypeSyntax>()])); 3416var type = typeSymbol.GenerateTypeSyntax(); 3447=> SyntaxFactory.ArrayType((TypeSyntax)type, [SyntaxFactory.ArrayRankSpecifier()]); 3457return SyntaxFactory.NullableType((TypeSyntax)type); 3465=> SyntaxFactory.TupleElement((TypeSyntax)type, name?.ToIdentifierToken() ?? default); 3512SyntaxFactory.CatchDeclaration((TypeSyntax)type, name.ToIdentifierToken()),
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (3)
135ArrayBuilder<string> builder, TypeSyntax type, 641private static string GetTypeName(TypeSyntax type) 699if (node is TypeSyntax typeNode)
Rename\CSharpRenameRewriterLanguageService.cs (2)
1179if (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); 774foreach (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 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, 580NameSyntax name, TypeSyntax reducedName, SemanticModel semanticModel) 615private static bool CanReplaceWithReducedName(NameSyntax name, TypeSyntax reducedName, SemanticModel semanticModel, CancellationToken cancellationToken) 626private static bool IsNotNullableReplaceable(NameSyntax name, TypeSyntax reducedName)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
203public 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)
607while (topExpression.Parent is TypeSyntax typeSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (1)
138public static TypeSyntax GetMemberType(this MemberDeclarationSyntax member)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (5)
185TypeSyntax type, 320TypeSyntax type, 345private static TypeSyntax GetOutermostType(TypeSyntax type) 346=> 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)
772var type = memberDeclaration.GetMemberType(); 1573=> node is TypeSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1437var originalMemberType = originalMemberSymbol.GetMemberType(); 1438var rewrittenMemberType = rewrittenMemberSymbol.GetMemberType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (2)
119var xArg = x.TypeArgumentList.Arguments[i]; 120var 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 (6)
18private readonly TypeSyntax _typeName; 38public TypeStyleResult(CSharpTypeStyleHelper helper, TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, bool isStylePreferred, NotificationOption2 notificationOption, CancellationToken cancellationToken) : this() 59TypeSyntax typeName, SemanticModel semanticModel, 77TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 80SyntaxToken identifier, TypeSyntax typeName, ExpressionSyntax initializer, SemanticModel semanticModel, CSharpSimplifierOptions options, CancellationToken cancellationToken); 82internal TypeSyntax? FindAnalyzableType(SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (3)
94var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 133var typeSyntax = GetTypeSyntaxFromDeclaration(declarationStatement); 140private static TypeSyntax? GetTypeSyntaxFromDeclaration(SyntaxNode declarationStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (2)
67TypeSyntax typeName, SemanticModel semanticModel, 139TypeSyntax typeName,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
30TypeSyntax typeName, SemanticModel semanticModel, 50var type = variableDeclaration.Type.StripRefIfNeeded(); 61var type = forEachStatement.Type.StripRefIfNeeded(); 98TypeSyntax typeName, SemanticModel semanticModel, 188var declarationTypeNode = declarationExpression.Type; 255TypeSyntax typeName,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (5)
10internal class TypeSyntaxComparer : IComparer<TypeSyntax?> 21public int Compare(TypeSyntax? x, TypeSyntax? y) 46private 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) 494targetToken.GetPreviousToken(includeSkipped: true).IsLastTokenOfNode<TypeSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (10)
949{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 1515if (leftToken.IsLastTokenOfNode<TypeSyntax>(out var typeSyntax)) 1520while (typeSyntax.Parent is TypeSyntax parentTypeSyntax) 2325if (binary.Left is TypeSyntax type && type.IsPotentialTypeName(semanticModel, cancellationToken)) 2346var type = previousToken.Parent as TypeSyntax; 2352var underlyingType = type is PointerTypeSyntax pointerType 2386return conditionalExpression.Condition is not TypeSyntax type 2845var type = token.GetAncestors<TypeSyntax>().LastOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
119var typeSyntax = targetType.GenerateTypeSyntax();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (5)
33public static TypeSyntax GenerateTypeSyntax(this INamespaceOrTypeSymbol symbol, bool allowVar = true) 36private static TypeSyntax GenerateTypeSyntax( 49var syntax = containsAnonymousType 74public static TypeSyntax GenerateRefTypeSyntax( 84public static TypeSyntax GenerateRefReadOnlyTypeSyntax(
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 class TypeSyntaxGeneratorVisitor : SymbolVisitor<TypeSyntax> 35public override TypeSyntax DefaultVisit(ISymbol node) 39where TTypeSyntax : TypeSyntax 47public override TypeSyntax VisitAlias(IAliasSymbol symbol) 58public override TypeSyntax VisitArrayType(IArrayTypeSymbol symbol) 88var elementTypeSyntax = underlyingType.GenerateTypeSyntax(); 100TypeSyntax arrayTypeSyntax = ArrayType(elementTypeSyntax, [.. ranks]); 110public override TypeSyntax VisitDynamicType(IDynamicTypeSymbol symbol) 118public static bool TryCreateNativeIntegerType(INamedTypeSymbol symbol, [NotNullWhen(true)] out TypeSyntax? syntax) 130public override TypeSyntax VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 174public TypeSyntax CreateSimpleTypeSyntax(INamedTypeSymbol symbol) 178var syntax = TryCreateSpecializedNamedTypeSyntax(symbol); 204? Enumerable.Repeat((TypeSyntax)OmittedTypeArgument(), symbol.TypeArguments.Length) 224private static TypeSyntax? TryCreateSpecializedNamedTypeSyntax(INamedTypeSymbol symbol) 263public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol) 265if (TryCreateNativeIntegerType(symbol, out var typeSyntax)) 277var containingTypeSyntax = symbol.ContainingType.Accept(this); 301var container = symbol.ContainingNamespace.Accept(this)!; 318public override TypeSyntax VisitNamespace(INamespaceSymbol symbol) 332var container = symbol.ContainingNamespace.Accept(this)!; 343private static TypeSyntax AddGlobalAlias(INamespaceOrTypeSymbol symbol, SimpleNameSyntax syntax) 351public override TypeSyntax VisitPointerType(IPointerTypeSymbol symbol) 360public override TypeSyntax VisitTypeParameter(ITypeParameterSymbol symbol) 362TypeSyntax 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 (2)
67type == null ? SyntaxFactory.IdentifierName("var") : (TypeSyntax)type, 236=> SyntaxFactory.TypePattern((TypeSyntax)type);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
1990var memberType = memberSymbol.GetMemberType(); 2043var type = symbol.GetMemberType(); 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)
266VerifySyntax<TypeSyntax>(Generator.IdentifierName("x"), "x"); 267VerifySyntax<TypeSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 268VerifySyntax<TypeSyntax>(Generator.DottedName("x.y"), "x.y"); 269VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 270VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 272VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.IdentifierName("x")), "x[]"); 273VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.ArrayTypeExpression(Generator.IdentifierName("x"))), "x[][]"); 274VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.IdentifierName("x")), "x?"); 275VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.NullableTypeExpression(Generator.IdentifierName("x"))), "x?"); 282VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(Generator.TupleElementExpression(Generator.IdentifierName("x")), Generator.TupleElementExpression(Generator.IdentifierName("y"))), "(x, y)"); 283VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }), "(global::System.Int32, global::System.Int32)"); 284VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }, ["x", "y"]), "(global::System.Int32 x, global::System.Int32 y)"); 290VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Byte), "byte"); 291VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_SByte), "sbyte"); 293VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int16), "short"); 294VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt16), "ushort"); 296VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int32), "int"); 297VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt32), "uint"); 299VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int64), "long"); 300VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt64), "ulong"); 302VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Single), "float"); 303VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Double), "double"); 305VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Char), "char"); 306VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_String), "string"); 308VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Object), "object"); 309VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Decimal), "decimal"); 4977VerifySyntax<TypeSyntax>(
Microsoft.Interop.ComInterfaceGenerator (5)
Marshallers\ObjectUnwrapperResolver.cs (2)
13internal sealed record ObjectUnwrapperInfo(TypeSyntax UnwrapperType) : MarshallingInfo; 37TypeSyntax unwrapperType = ((ObjectUnwrapperInfo)info.MarshallingAttributeInfo).UnwrapperType;
UnmanagedToManagedStubGenerator.cs (1)
108public (ParameterListSyntax ParameterList, TypeSyntax ReturnType, AttributeListSyntax? ReturnTypeAttributes) GenerateAbiMethodSignatureData()
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 (9)
JSExportCodeGenerator.cs (1)
231public (ParameterListSyntax ParameterList, TypeSyntax ReturnType, AttributeListSyntax? ReturnTypeAttributes) GenerateTargetMethodSignatureData()
JSImportCodeGenerator.cs (2)
171TypeArgumentList(SingletonSeparatedList<TypeSyntax>(IdentifierName(Constants.JSMarshalerArgumentGlobal))))) 207public (ParameterListSyntax ParameterList, TypeSyntax ReturnType, AttributeListSyntax? ReturnTypeAttributes) GenerateTargetMethodSignatureData()
JSManagedTypeInfo.cs (2)
179public JSSimpleTypeInfo(KnownManagedType knownType, TypeSyntax syntax) 184public TypeSyntax Syntax { get; init; }
Marshaling\FuncJSGenerator.cs (2)
116private static ArgumentSyntax ArgToJS(int i, TypeSyntax sourceType, MarshalerType marshalerType) => Argument(ParenthesizedLambdaExpression() 131private static ArgumentSyntax ArgToManaged(int i, TypeSyntax sourceType, MarshalerType marshalerType) => Argument(ParenthesizedLambdaExpression()
Marshaling\TaskJSGenerator.cs (2)
97private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source, TypeSyntax sourceType) 120private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source, TypeSyntax sourceType)
Microsoft.Interop.LibraryImportGenerator (1)
LibraryImportGenerator.cs (1)
441(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 (96)
BoundGenerators.cs (1)
174public (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)
146TypeSyntax managedElementType, 147TypeSyntax unmanagedElementType, 252TypeSyntax 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 (59)
49public static TypeSyntax Void { get; } = PredefinedType(Token(SyntaxKind.VoidKeyword)); 51public static TypeSyntax VoidStar { get; } = PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword))); 53public static TypeSyntax VoidStarStar { get; } = PointerType(PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword)))); 55public static TypeSyntax Nint { get; } = ParseTypeName(TypeNames.Nint); 57private static TypeSyntax? _StringMarshalling; 58public static TypeSyntax StringMarshalling => _StringMarshalling ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.StringMarshalling); 60private static TypeSyntax? _System_Runtime_InteropServices_ComWrappers_ComInterfaceEntry; 61public static TypeSyntax System_Runtime_InteropServices_ComWrappers_ComInterfaceEntry => _System_Runtime_InteropServices_ComWrappers_ComInterfaceEntry ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_ComWrappers_ComInterfaceEntry); 63private static TypeSyntax? _System_Runtime_InteropServices_NativeMemory; 64public static TypeSyntax System_Runtime_InteropServices_NativeMemory => _System_Runtime_InteropServices_NativeMemory ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_NativeMemory); 66private static TypeSyntax? _StrategyBasedComWrappers; 67public static TypeSyntax StrategyBasedComWrappers => _StrategyBasedComWrappers ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.StrategyBasedComWrappers); 69private static TypeSyntax? _IUnmanagedVirtualMethodTableProvider; 70public static TypeSyntax IUnmanagedVirtualMethodTableProvider => _IUnmanagedVirtualMethodTableProvider ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.IUnmanagedVirtualMethodTableProvider); 72private static TypeSyntax? _IIUnknownInterfaceType; 73public static TypeSyntax IIUnknownInterfaceType => _IIUnknownInterfaceType ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.IIUnknownInterfaceType); 75private static TypeSyntax? _IIUnknownDerivedDetails; 76public static TypeSyntax IIUnknownDerivedDetails => _IIUnknownDerivedDetails ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.IIUnknownDerivedDetails); 78private static TypeSyntax? _UnmanagedObjectUnwrapper; 79public static TypeSyntax UnmanagedObjectUnwrapper => _UnmanagedObjectUnwrapper ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.UnmanagedObjectUnwrapper); 81private static TypeSyntax? _IComExposedClass; 82public static TypeSyntax IComExposedClass => _IComExposedClass ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.IComExposedClass); 84private static TypeSyntax? _UnreachableException; 85public static TypeSyntax UnreachableException => _UnreachableException ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.UnreachableException); 87private static TypeSyntax? _System_Runtime_CompilerServices_RuntimeHelpers; 88public static TypeSyntax System_Runtime_CompilerServices_RuntimeHelpers => _System_Runtime_CompilerServices_RuntimeHelpers ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_CompilerServices_RuntimeHelpers); 90private static TypeSyntax? _System_Runtime_InteropServices_ComWrappers; 91public static TypeSyntax System_Runtime_InteropServices_ComWrappers => _System_Runtime_InteropServices_ComWrappers ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_ComWrappers); 93private static TypeSyntax? _System_IntPtr; 94public static TypeSyntax System_IntPtr => _System_IntPtr ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_IntPtr); 96private static TypeSyntax? _System_Guid; 97public static TypeSyntax System_Guid => _System_Guid ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Guid); 99private static TypeSyntax? _DllImportSearchPath; 100public static TypeSyntax DllImportSearchPath => _DllImportSearchPath ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.DllImportSearchPath); 102private static TypeSyntax? _System_Type; 103public static TypeSyntax System_Type => _System_Type ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Type); 105private static TypeSyntax? _System_Activator; 106public static TypeSyntax System_Activator => _System_Activator ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Activator); 108private static TypeSyntax? _System_Runtime_InteropServices_Marshal; 109public static TypeSyntax System_Runtime_InteropServices_Marshal => _System_Runtime_InteropServices_Marshal ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_Marshal); 111private static TypeSyntax? _System_Runtime_InteropServices_UnmanagedType; 112public static TypeSyntax System_Runtime_InteropServices_UnmanagedType => _System_Runtime_InteropServices_UnmanagedType ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_UnmanagedType); 114private static TypeSyntax? _System_Runtime_InteropServices_MemoryMarshal; 115public static TypeSyntax System_Runtime_InteropServices_MemoryMarshal => _System_Runtime_InteropServices_MemoryMarshal ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_MemoryMarshal); 117private static TypeSyntax? _System_Exception; 118public static TypeSyntax System_Exception => _System_Exception ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Exception); 120private static TypeSyntax? _System_GC; 121public static TypeSyntax System_GC => _System_GC ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_GC); 123private static TypeSyntax? _System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch; 124public static TypeSyntax System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch => _System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch); 126private static TypeSyntax? _System_Runtime_CompilerServices_Unsafe; 127public static TypeSyntax System_Runtime_CompilerServices_Unsafe => _System_Runtime_CompilerServices_Unsafe ??= ParseTypeName(TypeNames.GlobalAlias + TypeNames.System_Runtime_CompilerServices_Unsafe); 129private static TypeSyntax? _CallConvCdecl; 130private static TypeSyntax? _CallConvFastcall; 131private static TypeSyntax? _CallConvMemberFunction; 132private static TypeSyntax? _CallConvStdcall; 133private static TypeSyntax? _CallConvSuppressGCTransition; 134private static TypeSyntax? _CallConvThiscall; 135public static TypeSyntax CallConv(string callConv)
TypeSymbolExtensions.cs (1)
170public static TypeSyntax AsTypeSyntax(this ITypeSymbol type)
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)
60private static void AppendTypeName(StringBuilder builder, TypeSyntax type)
CodeModel\MethodXml\MethodXmlBuilder.cs (1)
142private bool TryGenerateType(TypeSyntax type)