diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system.nim | 10 | ||||
-rw-r--r-- | lib/system/jssys.nim | 7 |
2 files changed, 8 insertions, 9 deletions
diff --git a/lib/system.nim b/lib/system.nim index 85ef15e08..fb008dc45 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2394,14 +2394,8 @@ when notJSnotNims: """.} when defined(js): - when not defined(nimscript): - include "system/jssys" - include "system/reprjs" - else: - proc cmp(x, y: string): int = - if x == y: return 0 - if x < y: return -1 - return 1 + include "system/jssys" + include "system/reprjs" when defined(js) or defined(nimscript): proc addInt*(result: var string; x: int64) = diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim index e2ceedc2c..5f18f01cb 100644 --- a/lib/system/jssys.nim +++ b/lib/system/jssys.nim @@ -340,7 +340,12 @@ proc cmpStrings(a, b: string): int {.asmNoStackFrame, compilerproc.} = """ proc cmp(x, y: string): int = - return cmpStrings(x, y) + when nimvm: + if x == y: result = 0 + elif x < y: result = -1 + else: result = 1 + else: + result = cmpStrings(x, y) proc eqStrings(a, b: string): bool {.asmNoStackFrame, compilerproc.} = asm """ |