diff options
| -rw-r--r-- | src/main/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/TypescriptWriter.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/TypescriptWriter.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/TypescriptWriter.java index 46ccdc1..3d5d99f 100644 --- a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/TypescriptWriter.java +++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/TypescriptWriter.java @@ -91,10 +91,7 @@ public class TypescriptWriter implements AutoCloseable { ); this.writer.write("} from "); - // TODO: proper string literals - this.writer.write("\""); - this.writer.write(importDeclaration.fromModule()); - this.writer.write("\""); + this.writeStringLiteral(importDeclaration.fromModule()); this.writer.write(";"); this.writer.newLine(); } @@ -450,9 +447,13 @@ public class TypescriptWriter implements AutoCloseable { } private void writeStringLiteral(TypescriptStringLiteral stringLiteral) throws IOException { + this.writeStringLiteral(stringLiteral.value()); + } + + private void writeStringLiteral(String value) throws IOException { this.writer.write("\""); this.writer.write( - stringLiteral.value() + value .replace("\\", "\\\\") .replace("\"", "\\\"") .replace("\n", "\\n") |
