Skip to content

Commit 98bbddd

Browse files
Get identifier specifically from each type rather than including random trivia
1 parent 35aa2ce commit 98bbddd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

CodeConverter/CSharp/DeclarationNodeVisitor.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,12 @@ string GetCSharpIdentifierText(VBSyntax.EventContainerSyntax p)
628628
return "base";
629629
case VBSyntax.KeywordEventContainerSyntax _:
630630
return "this";
631+
case VBSyntax.WithEventsEventContainerSyntax weecs:
632+
return CommonConversions.CsEscapedIdentifier(weecs.Identifier.Text).Text;
633+
case VBSyntax.WithEventsPropertyEventContainerSyntax wepecs:
634+
return CommonConversions.CsEscapedIdentifier(wepecs.Property.Identifier.Text).Text;
631635
default:
632-
return CommonConversions.CsEscapedIdentifier(p.GetText().ToString().Trim()).Text;
636+
throw new ArgumentOutOfRangeException(nameof(p), p, $"Unrecognized event container: `{p}`");
633637
}
634638
}
635639
}

0 commit comments

Comments
 (0)