fix(lanzou): correct comment parsing logic in lanzou driver

- Adjusted logic to skip incrementing index when exiting comments.
- Added checks to continue loop if inside a single-line or block comment.
- Prevents erroneous parsing and retains intended comment exclusion.
pull/9278/head
okatu-loli 2025-08-18 18:45:57 +08:00
parent 97d4f79b96
commit 7714e00bf9
1 changed files with 4 additions and 0 deletions

View File

@ -94,6 +94,7 @@ func RemoveJSComment(data string) string {
}
if inComment && v == '*' && i+1 < len(data) && data[i+1] == '/' {
inComment = false
i++
continue
}
if v == '/' && i+1 < len(data) {
@ -108,6 +109,9 @@ func RemoveJSComment(data string) string {
continue
}
}
if inComment || inSingleLineComment {
continue
}
result.WriteByte(v)
}