C: fix generation of '#line' directive

This commit is contained in:
Alexey Andreev 2019-05-17 17:39:29 +03:00
parent 86b5daa3cf
commit 4c50ed8714

View File

@ -182,17 +182,15 @@ public class BufferedCodeWriter extends CodeWriter {
fileName = initialFileName; fileName = initialFileName;
lineNumber = absLineNumber; lineNumber = absLineNumber;
} }
if (!Objects.equals(this.fileName, fileName) || this.lineNumber != lineNumber) { if (isNewLine) {
if (isNewLine) { pendingFileName = fileName;
pendingFileName = fileName; pendingLineNumber = lineNumber;
pendingLineNumber = lineNumber; } else if (!Objects.equals(this.fileName, fileName) || this.lineNumber != lineNumber) {
} else { this.lineNumber++;
this.lineNumber++; absLineNumber++;
absLineNumber++; writer.println();
writer.println(); printLineDirective(fileName, lineNumber);
printLineDirective(fileName, lineNumber); isNewLine = true;
isNewLine = true;
}
} }
} }
} }