Skip to content

Commit e182ef5

Browse files
authored
C#: Dont close the block comment if the user comment contains */ (#1533)
* #1515 dont close the comment` * add test
1 parent 85d10eb commit e182ef5

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

crates/csharp/src/interface.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,7 @@ impl InterfaceGenerator<'_> {
10211021
.trim()
10221022
.replace("<", "&lt;")
10231023
.replace(">", "&gt;")
1024+
.replace("*/", "*") // We can't close the comment, so if the user comment has */ we just remove the /
10241025
.lines()
10251026
.map(|line| format!("* {line}"))
10261027
.collect::<Vec<_>>()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package local:demo;
2+
3+
world w {
4+
export i;
5+
}
6+
7+
/// Test we can handle "comment injection - attempting to close the comment we generate around wit comments
8+
interface i {
9+
/// */
10+
record r {
11+
x: u32,
12+
}
13+
}

0 commit comments

Comments
 (0)