From 4c50ed87146925c8ded5c0b5b932b8878cf73c31 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 17 May 2019 17:39:29 +0300 Subject: [PATCH] C: fix generation of '#line' directive --- .../c/generate/BufferedCodeWriter.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/org/teavm/backend/c/generate/BufferedCodeWriter.java b/core/src/main/java/org/teavm/backend/c/generate/BufferedCodeWriter.java index 1caaecbc5..39ae8fcc2 100644 --- a/core/src/main/java/org/teavm/backend/c/generate/BufferedCodeWriter.java +++ b/core/src/main/java/org/teavm/backend/c/generate/BufferedCodeWriter.java @@ -182,17 +182,15 @@ public class BufferedCodeWriter extends CodeWriter { fileName = initialFileName; lineNumber = absLineNumber; } - if (!Objects.equals(this.fileName, fileName) || this.lineNumber != lineNumber) { - if (isNewLine) { - pendingFileName = fileName; - pendingLineNumber = lineNumber; - } else { - this.lineNumber++; - absLineNumber++; - writer.println(); - printLineDirective(fileName, lineNumber); - isNewLine = true; - } + if (isNewLine) { + pendingFileName = fileName; + pendingLineNumber = lineNumber; + } else if (!Objects.equals(this.fileName, fileName) || this.lineNumber != lineNumber) { + this.lineNumber++; + absLineNumber++; + writer.println(); + printLineDirective(fileName, lineNumber); + isNewLine = true; } } }