Skip to content

Commit c5dd5d0

Browse files
committed
Fixed cast expression.
1 parent a791fd8 commit c5dd5d0

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

CSharpToJavaScript/Walker.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3095,18 +3095,31 @@ public override void VisitParenthesizedExpression(ParenthesizedExpressionSyntax
30953095
public override void VisitCastExpression(CastExpressionSyntax node)
30963096
{
30973097
ChildSyntaxList nodesAndTokens = node.ChildNodesAndTokens();
3098+
3099+
bool skipTokens = false;
30983100

30993101
for (int i = 0; i < nodesAndTokens.Count; i++)
31003102
{
31013103
SyntaxNode? asNode = nodesAndTokens[i].AsNode();
3104+
3105+
if (skipTokens)
3106+
{
3107+
if (asNode != null)
3108+
continue;
3109+
3110+
if (nodesAndTokens[i].AsToken().Kind() == SyntaxKind.CloseParenToken)
3111+
skipTokens = false;
3112+
3113+
continue;
3114+
}
3115+
31023116

31033117
if (asNode != null)
31043118
{
31053119
SyntaxKind kind = asNode.Kind();
31063120

31073121
switch (kind)
31083122
{
3109-
case SyntaxKind.IdentifierName:
31103123
case SyntaxKind.NullableType:
31113124
case SyntaxKind.PredefinedType:
31123125
{
@@ -3115,6 +3128,9 @@ public override void VisitCastExpression(CastExpressionSyntax node)
31153128
#endif
31163129
break;
31173130
}
3131+
case SyntaxKind.IdentifierName:
3132+
VisitIdentifierName((IdentifierNameSyntax)asNode);
3133+
break;
31183134
case SyntaxKind.ArgListExpression:
31193135
case SyntaxKind.NumericLiteralExpression:
31203136
case SyntaxKind.StringLiteralExpression:
@@ -3163,6 +3179,10 @@ public override void VisitCastExpression(CastExpressionSyntax node)
31633179
switch (kind)
31643180
{
31653181
case SyntaxKind.OpenParenToken:
3182+
{
3183+
skipTokens = true;
3184+
break;
3185+
}
31663186
case SyntaxKind.CloseParenToken:
31673187
break;
31683188
default:

0 commit comments

Comments
 (0)