110 references to CastExpression
Microsoft.CodeAnalysis.CSharp (7)
Binder\Binder_Expressions.cs (2)
627
case SyntaxKind.
CastExpression
:
2960
case SyntaxKind.
CastExpression
:
Binder\EarlyWellKnownAttributeBinder.cs (1)
105
case SyntaxKind.
CastExpression
:
Parser\LanguageParser.cs (1)
10827
case SyntaxKind.
CastExpression
:
Syntax\SyntaxFacts.cs (2)
113
case
CastExpression
:
348
while (current != null && (current.IsKind(ParenthesizedExpression) || current.IsKind(
CastExpression
))) current = current.Parent;
Syntax\SyntaxNodeExtensions.cs (1)
150
if (node.Parent.IsKind(SyntaxKind.
CastExpression
))
Microsoft.CodeAnalysis.CSharp.CodeStyle (14)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
24
[SyntaxKind.
CastExpression
, SyntaxKind.AsExpression];
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
131
case SyntaxKind.
CastExpression
:
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
198
if (!declaratorValue.IsKind(SyntaxKind.
CastExpression
, out castExpression))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
88
if (initializerExpression.Kind() is SyntaxKind.
CastExpression
or SyntaxKind.IsExpression or SyntaxKind.AsExpression)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
726
case SyntaxKind.
CastExpression
:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (5)
167
if (nodeParent.IsKind(SyntaxKind.
CastExpression
) && expression.IsKind(SyntaxKind.ThisExpression))
292
if (parentExpression.IsKind(SyntaxKind.
CastExpression
) &&
584
binaryExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.
CastExpression
)
645
|| lessThanExpression.Left.IsKind(SyntaxKind.
CastExpression
))
680
&& greaterThanExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.
CastExpression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (3)
170
if ((previousParentKind == SyntaxKind.
CastExpression
&& previousKind == SyntaxKind.OpenParenToken) ||
171
(currentParentKind == SyntaxKind.
CastExpression
&& currentKind == SyntaxKind.CloseParenToken))
202
if (previousParentKind == SyntaxKind.
CastExpression
&& previousKind == SyntaxKind.CloseParenToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
979
=> node is ExpressionSyntax expression && expression.WalkDownParentheses().Kind() is SyntaxKind.
CastExpression
or SyntaxKind.AsExpression;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (1)
41
or SyntaxKind.
CastExpression
||
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (1)
60
or SyntaxKind.
CastExpression
||
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
274
if (token.Parent.IsKind(SyntaxKind.
CastExpression
))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (3)
1247
if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.
CastExpression
))
1577
SyntaxKind.
CastExpression
))
2049
token.Parent.IsKind(SyntaxKind.
CastExpression
))
Microsoft.CodeAnalysis.CSharp.Features (11)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
243
if (node.IsParentKind(SyntaxKind.
CastExpression
))
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
437
while (parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.
CastExpression
)
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (1)
152
token.GetRequiredParent().Kind() == SyntaxKind.
CastExpression
)
Completion\CompletionProviders\TupleNameCompletionProvider.cs (1)
77
if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.
CastExpression
))
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (1)
35
protected override int FromKind => (int)SyntaxKind.
CastExpression
;
Debugging\CSharpProximityExpressionsService_ExpressionTermCollector.cs (1)
89
case SyntaxKind.
CastExpression
:
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
24
[SyntaxKind.
CastExpression
, SyntaxKind.AsExpression];
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
131
case SyntaxKind.
CastExpression
:
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
198
if (!declaratorValue.IsKind(SyntaxKind.
CastExpression
, out castExpression))
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (1)
41
or SyntaxKind.
CastExpression
||
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (1)
60
or SyntaxKind.
CastExpression
||
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\StackAllocInitializerTests.cs (1)
1154
Assert.Equal(SyntaxKind.
CastExpression
, obj1.Initializer.Value.Kind());
Semantics\StackAllocSpanExpressionsTests.cs (1)
132
Assert.Equal(SyntaxKind.
CastExpression
, obj1.Initializer.Value.Kind());
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (49)
Parsing\CollectionExpressionParsingTests.cs (22)
3882
N(SyntaxKind.
CastExpression
);
3936
N(SyntaxKind.
CastExpression
);
3998
N(SyntaxKind.
CastExpression
);
4172
N(SyntaxKind.
CastExpression
);
4230
N(SyntaxKind.
CastExpression
);
4287
N(SyntaxKind.
CastExpression
);
4408
N(SyntaxKind.
CastExpression
);
4522
N(SyntaxKind.
CastExpression
);
4583
N(SyntaxKind.
CastExpression
);
4645
N(SyntaxKind.
CastExpression
);
4695
N(SyntaxKind.
CastExpression
);
5060
N(SyntaxKind.
CastExpression
);
5122
N(SyntaxKind.
CastExpression
);
5192
N(SyntaxKind.
CastExpression
);
5233
N(SyntaxKind.
CastExpression
);
5381
N(SyntaxKind.
CastExpression
);
5415
N(SyntaxKind.
CastExpression
);
5518
N(SyntaxKind.
CastExpression
);
5549
N(SyntaxKind.
CastExpression
);
5585
N(SyntaxKind.
CastExpression
);
5654
N(SyntaxKind.
CastExpression
);
5715
N(SyntaxKind.
CastExpression
);
Parsing\DeconstructionTests.cs (1)
1954
Assert.Equal(SyntaxKind.
CastExpression
, lhsContent.Expression.Kind());
Parsing\ExpressionParsingTests.cs (1)
931
Assert.Equal(SyntaxKind.
CastExpression
, expr.Kind());
Parsing\FunctionPointerTests.cs (2)
1833
N(SyntaxKind.
CastExpression
);
1940
N(SyntaxKind.
CastExpression
);
Parsing\MemberDeclarationParsingTests.cs (8)
16221
N(SyntaxKind.
CastExpression
);
16258
N(SyntaxKind.
CastExpression
);
16374
N(SyntaxKind.
CastExpression
);
16413
N(SyntaxKind.
CastExpression
);
16787
N(SyntaxKind.
CastExpression
);
16834
N(SyntaxKind.
CastExpression
);
16968
N(SyntaxKind.
CastExpression
);
17017
N(SyntaxKind.
CastExpression
);
Parsing\NullableParsingTests.cs (3)
99
N(SyntaxKind.
CastExpression
);
222
N(SyntaxKind.
CastExpression
);
275
N(SyntaxKind.
CastExpression
);
Parsing\PatternParsingTests.cs (8)
7723
N(SyntaxKind.
CastExpression
);
7749
N(SyntaxKind.
CastExpression
);
10536
N(SyntaxKind.
CastExpression
);
10774
N(SyntaxKind.
CastExpression
);
10827
N(SyntaxKind.
CastExpression
);
10878
N(SyntaxKind.
CastExpression
);
10935
N(SyntaxKind.
CastExpression
);
11152
N(SyntaxKind.
CastExpression
);
Parsing\RangeExpressionParsingTests.cs (3)
18
N(SyntaxKind.
CastExpression
);
39
N(SyntaxKind.
CastExpression
);
239
N(SyntaxKind.
CastExpression
);
Parsing\StatementAttributeParsingTests.cs (1)
4477
N(SyntaxKind.
CastExpression
);
Microsoft.CodeAnalysis.CSharp.Workspaces (20)
Simplification\Reducers\CSharpCastReducer.Rewriter.cs (4)
37
if ((node.Left.IsKind(SyntaxKind.
CastExpression
) && !reducedNode.Left.IsKind(SyntaxKind.
CastExpression
)) ||
38
(node.Right.IsKind(SyntaxKind.
CastExpression
) && !reducedNode.Right.IsKind(SyntaxKind.
CastExpression
)))
Simplification\Simplifiers\NameSimplifier.cs (1)
669
if (!reparsedCastExpression.IsKind(SyntaxKind.
CastExpression
))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (1)
88
if (initializerExpression.Kind() is SyntaxKind.
CastExpression
or SyntaxKind.IsExpression or SyntaxKind.AsExpression)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
726
case SyntaxKind.
CastExpression
:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (5)
167
if (nodeParent.IsKind(SyntaxKind.
CastExpression
) && expression.IsKind(SyntaxKind.ThisExpression))
292
if (parentExpression.IsKind(SyntaxKind.
CastExpression
) &&
584
binaryExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.
CastExpression
)
645
|| lessThanExpression.Left.IsKind(SyntaxKind.
CastExpression
))
680
&& greaterThanExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.
CastExpression
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (3)
170
if ((previousParentKind == SyntaxKind.
CastExpression
&& previousKind == SyntaxKind.OpenParenToken) ||
171
(currentParentKind == SyntaxKind.
CastExpression
&& currentKind == SyntaxKind.CloseParenToken))
202
if (previousParentKind == SyntaxKind.
CastExpression
&& previousKind == SyntaxKind.CloseParenToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
979
=> node is ExpressionSyntax expression && expression.WalkDownParentheses().Kind() is SyntaxKind.
CastExpression
or SyntaxKind.AsExpression;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
274
if (token.Parent.IsKind(SyntaxKind.
CastExpression
))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (3)
1247
if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.
CastExpression
))
1577
SyntaxKind.
CastExpression
))
2049
token.Parent.IsKind(SyntaxKind.
CastExpression
))
Microsoft.VisualStudio.LanguageServices.CSharp (1)
CodeModel\MethodXml\MethodXmlBuilder.cs (1)
192
case SyntaxKind.
CastExpression
: