summary refs log tree commit diff stats
path: root/src/nre.nim
diff options
context:
space:
mode:
authorFlaviu Tamas <tamasflaviu@gmail.com>2015-03-04 21:45:56 -0500
committerFlaviu Tamas <tamasflaviu@gmail.com>2015-03-04 21:45:56 -0500
commite5e5970d93f3b823b1f219f36f1be7cd6050637a (patch)
tree540568580d6045125146181c1a40f0af0b9f4276 /src/nre.nim
parentab6e83ad4185e9623947dc82e4176c84eb05716a (diff)
downloadNim-e5e5970d93f3b823b1f219f36f1be7cd6050637a.tar.gz
Fix broken logic in 7296c6d
Thanks @fowlmouth for pointing this problem out in IRC.
Diffstat (limited to 'src/nre.nim')
-rw-r--r--src/nre.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nre.nim b/src/nre.nim
index dd00cf822..6d6f90046 100644
--- a/src/nre.nim
+++ b/src/nre.nim
@@ -175,10 +175,12 @@ proc `$`*(pattern: RegexMatch): string =
 
 proc `==`*(a, b: Regex): bool =
   # name-to-number table is generated at init time, doesn't need to be checked
-  return not a.isNil and not b.isNil and
-         a.pattern   == b.pattern and
-         a.pcreObj   == b.pcreObj and
-         a.pcreExtra == b.pcreExtra
+  if not a.isNil and not b.isNil:
+    return a.pattern   == b.pattern and
+           a.pcreObj   == b.pcreObj and
+           a.pcreExtra == b.pcreExtra
+  else:
+    return system.`==`(a, b)
 
 proc `==`*(a, b: RegexMatch): bool =
   # don't need to compare matchbounds, if pattern and str equal, everything