java codegen: Don't emit backslashes in comments.

This commit is contained in:
Ted Stein 2017-08-31 13:47:47 -07:00 коммит произвёл Chad Walters
Родитель f8f867a354
Коммит a08163e546
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -182,7 +182,17 @@ javaCodegen Java {..} = do
let content =
if no_banner
then code
else (commonHeader "//" bondFile javaFile <> code)
else (commonHeader "//" safeBondFile safeJavaFile <> code)
where
-- javac will always treat "\u" as the start
-- of a unicode escape sequence, and will
-- error out if it isn't followed by a valid
-- code. This breaks compilation of generated
-- code if either path has components that
-- start with u.
backToForward s = map (\c -> if c == '\\' then '/' else c) s
safeBondFile = backToForward bondFile
safeJavaFile = backToForward javaFile
createDir packageDir
LTIO.writeFile (packageDir </> javaFile) content