From d0707e535576304d9c2a965ee5df32f26d0d0ee1 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Tue, 3 Sep 2024 20:54:34 +0200 Subject: [PATCH] js: emit non-breaking whitespace before function arrow in remaining places --- .../backend/javascript/templating/TemplatingAstWriter.java | 2 +- jso/impl/src/main/java/org/teavm/jso/impl/JSAliasRenderer.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/teavm/backend/javascript/templating/TemplatingAstWriter.java b/core/src/main/java/org/teavm/backend/javascript/templating/TemplatingAstWriter.java index be2dd7ebe..10bb9a2ed 100644 --- a/core/src/main/java/org/teavm/backend/javascript/templating/TemplatingAstWriter.java +++ b/core/src/main/java/org/teavm/backend/javascript/templating/TemplatingAstWriter.java @@ -127,7 +127,7 @@ public class TemplatingAstWriter extends AstWriter { if (classInitializerInfo == null || classInitializerInfo.isDynamicInitializer(className)) { writer.appendClassInit(className); } else { - writer.append("(()").ws().append("=>").ws().append("{})"); + writer.append("(()").sameLineWs().append("=>").ws().append("{})"); } return true; } diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSAliasRenderer.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSAliasRenderer.java index 939dcd27d..00f9a6860 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSAliasRenderer.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSAliasRenderer.java @@ -64,7 +64,7 @@ class JSAliasRenderer implements RendererListener, MethodContributor { writer.startVariableDeclaration().appendFunction("$rt_jso_marker") .appendGlobal("Symbol").append("('jsoClass')").endDeclaration(); - writer.append("(()").ws().append("=>").ws().append("{").softNewLine().indent(); + writer.append("(()").sameLineWs().append("=>").ws().append("{").softNewLine().indent(); writer.append("let c;").softNewLine(); var exportedNamesByClass = new HashMap(); for (var className : classSource.getClassNames()) {