mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
fix nim js cmp fails at CT (#16473)
This commit is contained in:
@@ -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) =
|
||||
|
||||
@@ -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 """
|
||||
|
||||
Reference in New Issue
Block a user