jac3km4 / redscript

Compiler/decompiler toolkit for redscript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiler source map fails if file doesn't end with newline

flibdev opened this issue · comments

Ran across this edge case while I was digging through a monolithic classes.redscript and documenting things as comments in the new script file I was creating. I was using single line comments and hadn't put a newline at the end, it was commenting out the function annotation in the next file in the folder alphabetically.

Looks like it's because Files.add(...) in compiler/src/source_map.rs only splits on the newline character and just concatenates the source files together.

Easily avoided, but a possible issue. Perhaps fix with just forcing a newline at the end of every source file?

Also the compiler throws errors about the wrong file if there's a syntax error on the first line of any file that isn't the first one in a folder. Same fix would work.

commented

I think this is fixed with adbc68f, feel free to give it a test

Yep, appears to be fixed. I can't replicate the error any more.