summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorJuan Carlos <juancarlospaco@gmail.com>2019-10-30 10:12:17 -0300
committerAndreas Rumpf <rumpf_a@web.de>2019-10-30 14:12:17 +0100
commitb5bb58164270a819cfb37655139251955541a964 (patch)
treed0e1eccc679d147df2606f69b290b989d58d3ceb /lib/system
parent34dbc5699e8cb36e26bad5a57edc972b82f26c5f (diff)
downloadNim-b5bb58164270a819cfb37655139251955541a964.tar.gz
Improve Math.Trunc code emit on JS, had weird whitespaces and indents (#12549)
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/jssys.nim20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim
index 3908fb3d9..b9b0fe586 100644
--- a/lib/system/jssys.nim
+++ b/lib/system/jssys.nim
@@ -758,13 +758,13 @@ else:
 
 # Workaround for IE, IE up to version 11 lacks 'Math.trunc'. We produce
 # 'Math.trunc' for Nim's ``div`` and ``mod`` operators:
-when not defined(nodejs):
-  {.emit: """
-  if (!Math.trunc) {
-    Math.trunc = function(v) {
-      v = +v;
-      if (!isFinite(v)) return v;
-
-      return (v - v % 1)   ||   (v < 0 ? -0 : v === 0 ? v : 0);
-    };
-  }""".}
+const jsMathTrunc = """
+if (!Math.trunc) {
+  Math.trunc = function(v) {
+    v = +v;
+    if (!isFinite(v)) return v;
+    return (v - v % 1) || (v < 0 ? -0 : v === 0 ? v : 0);
+  };
+}
+"""
+when not defined(nodejs): {.emit: jsMathTrunc .}