Closed Furrior closed 2 months ago
Possible solution:
diff --git a/DMCompiler/Compiler/DMPreprocessor/DMPreprocessor.cs b/DMCompiler/Compiler/DMPreprocessor/DMPreprocessor.cs
index 0b77570f..1d9db66d 100644
--- a/DMCompiler/Compiler/DMPreprocessor/DMPreprocessor.cs
+++ b/DMCompiler/Compiler/DMPreprocessor/DMPreprocessor.cs
@@ -94,6 +94,7 @@ public sealed class DMPreprocessor(bool enableDirectives) : IEnumerable<Token> {
HandleUndefineDirective(token);
break;
case TokenType.DM_Preproc_If:
+ _bufferedWhitespace.Clear();
HandleIfDirective(token);
break;
case TokenType.DM_Preproc_Ifdef:
See title. #ifdef works fine. Original discord message I used this command
ODCompiler --suppress-unimplemented --dump-preprocessor --no-standard tgstation.dme
and tg repo to reproduce.This:
Becomes this:
Workaround is to add an extra empty line:
Resulting in correct code:
It also can insert more than one tab. Example:
becomes
Simple case to reproduce/use as an unit test