Skip to content

Commit 1d450f5

Browse files
chrsmpigpigyyy
authored andcommitted
bugfix: insert comma before eol comment when line numbers on
1 parent c0cf60f commit 1d450f5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/yuescript/yue_compiler.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10020,7 +10020,12 @@ class YueCompilerImpl {
1002010020
if (baseEntries[i].second && i != lastValue) {
1002110021
auto pos = item.rfind('\n');
1002210022
if (pos != std::string::npos) {
10023-
item.insert(pos, ",");
10023+
auto comment = item.rfind("-- ");
10024+
if (comment != std::string::npos && comment < pos) {
10025+
item.insert(comment - 1, ",");
10026+
} else {
10027+
item.insert(pos, ",");
10028+
}
1002410029
} else {
1002510030
item.push_back(',');
1002610031
}

0 commit comments

Comments
 (0)