Skip to content

Commit

Permalink
#127 workaround for GWT issues preventing strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
uruuru committed Jun 20, 2021
1 parent 7a7ec9b commit 816b7e9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/java/org/eclipse/elk/js/linker/NodeJsModuleLinker.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public ArtifactSet link(final TreeLogger logger, final LinkerContext context,
// get the generated javascript
String[] javaScript = result.getJavaScript();

out.print("'use strict';");
out.newline();
// create dummies for several things requested by gwt
out.newline();
out.print("// -------------- ");
Expand Down Expand Up @@ -68,6 +70,20 @@ public ArtifactSet link(final TreeLogger logger, final LinkerContext context,
out.print(" $moduleBase;");
out.newline();
out.newline();

// Workaround for strict mode, see #127
out.print("// -------------- ");
out.print(" WORKAROUND STRICT MODE, SEE #127 ");
out.print(" -------------- ");
out.newline();
if (context.isOutputCompact()) {
out.print("var g, i, o;");
} else {
out.print("var _xblockexpression;");
}
out.newline();
out.newline();

out.print("// -------------- ");
out.print(" GENERATED CODE ");
out.print(" -------------- ");
Expand Down

0 comments on commit 816b7e9

Please sign in to comment.