summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2021-01-13 05:29:30 -0600
committerGitHub <noreply@github.com>2021-01-13 12:29:30 +0100
commitb727217229c0d3040db463705545cdb6b1e5769b (patch)
treed62cb0d014e52482a46fbac309a17315ef0d6f68 /lib/core
parent61fd19c7e6880d77d20be01d25266e4195e631fa (diff)
downloadNim-b727217229c0d3040db463705545cdb6b1e5769b.tar.gz
refactor cmpNimIdentifier (#16611)
* refactor cmpNimIdentifier

* Apply suggestions from code review

Co-authored-by: Clyybber <darkmine956@gmail.com>

Co-authored-by: Clyybber <darkmine956@gmail.com>
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/macros.nim7
-rw-r--r--lib/core/typeinfo.nim5
2 files changed, 3 insertions, 9 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 204123f41..e579d6b30 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -1437,12 +1437,9 @@ when defined(nimVmEqIdent):
     ## these nodes will be unwrapped.
 
 else:
-  from std/private/strimpl import cmpIgnoreStyleImpl
-  # this procedure is optimized for native code, it should not be compiled to nimVM bytecode.
-  proc cmpIgnoreStyle(a, b: cstring): int {.noSideEffect.} =
-    cmpIgnoreStyleImpl(a, b, true)
+  from std/private/strimpl import cmpNimIdentifier
 
-  proc eqIdent*(a, b: string): bool = cmpIgnoreStyle(a, b) == 0
+  proc eqIdent*(a, b: string): bool = cmpNimIdentifier(a, b) == 0
     ## Check if two idents are equal.
 
   proc eqIdent*(node: NimNode; s: string): bool {.compileTime.} =
diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim
index 9b7e32466..b2f5d771f 100644
--- a/lib/core/typeinfo.nim
+++ b/lib/core/typeinfo.nim
@@ -91,7 +91,7 @@ when not defined(gcDestructors):
 else:
   include system/seqs_v2_reimpl
 
-from std/private/strimpl import cmpIgnoreStyleImpl
+from std/private/strimpl import cmpNimIdentifier
 
 when not defined(js):
   template rawType(x: Any): PNimType =
@@ -368,9 +368,6 @@ iterator fields*(x: Any): tuple[name: string, any: Any] =
   for name, any in items(ret):
     yield ($name, any)
 
-proc cmpNimIdentifier(a, b: cstring): int {.noSideEffect.} =
-  cmpIgnoreStyleImpl(a, b, true)
-
 proc getFieldNode(p: pointer, n: ptr TNimNode,
                   name: cstring): ptr TNimNode =
   case n.kind