Skip to content

Commit d82f236

Browse files
author
Samuel Groß
committed
Don't omit empty lines in ScriptWriter
When for example emitting a multiline comment, we used to omit empty lines before. This is probably not quite what we want, so we should use omittingEmptySubsequences: false as argument to split().
1 parent 59d96b0 commit d82f236

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Sources/Fuzzilli/Lifting/ScriptWriter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ struct ScriptWriter {
5050
mutating func emitComment(_ comment: String) {
5151
guard !stripComments else { return }
5252

53-
for line in comment.split(separator: "\n") {
53+
for line in comment.split(separator: "\n", omittingEmptySubsequences: false) {
5454
emit("// " + line)
5555
}
5656
}
5757

5858
/// Emit one or more lines of code.
5959
mutating func emitBlock(_ block: String) {
60-
for line in block.split(separator: "\n") {
60+
for line in block.split(separator: "\n", omittingEmptySubsequences: false) {
6161
if stripComments {
6262
let trimmedLine = line.trimmingCharacters(in: .whitespacesAndNewlines)
6363
if trimmedLine.hasPrefix("//") || (trimmedLine.hasPrefix("/*") && trimmedLine.hasSuffix("*/")) {

0 commit comments

Comments
 (0)