Skip to content

Commit ab02f89

Browse files
committed
Added special syntax "//...\\"
Mostly for tests, for generating valid c# code.
1 parent a10d087 commit ab02f89

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

CSharpToJavaScript/Walker.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,20 @@ public override void VisitTrivia(SyntaxTrivia trivia)
5555
{
5656
switch (trivia.Kind())
5757
{
58+
case SyntaxKind.SingleLineCommentTrivia:
59+
{
60+
string _full = trivia.ToString();
61+
62+
//special syntax.
63+
//for writing js code //...\\
64+
if (_full.EndsWith(@"\\"))
65+
JSSB.Append(_full.AsSpan(2, _full.Length - 4));
66+
else
67+
JSSB.Append(_full);
68+
return;
69+
}
5870
case SyntaxKind.MultiLineCommentTrivia:
5971
case SyntaxKind.WhitespaceTrivia:
60-
case SyntaxKind.SingleLineCommentTrivia:
6172
{
6273
string _full = trivia.ToFullString();
6374
JSSB.Append(_full);

0 commit comments

Comments
 (0)