summary refs log tree commit diff stats
path: root/compiler/btrees.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/btrees.nim')
-rw-r--r--compiler/btrees.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/btrees.nim b/compiler/btrees.nim
index 65edc54f3..18854d474 100644
--- a/compiler/btrees.nim
+++ b/compiler/btrees.nim
@@ -79,6 +79,9 @@ proc insert[Key, Val](h: Node[Key, Val], key: Key, val: Val): Node[Key, Val] =
   var j = 0
   if not h.isInternal:
     while j < h.entries:
+      if eq(key, h.keys[j]):
+        h.vals[j] = val
+        return
       if less(key, h.keys[j]): break
       inc j
     for i in countdown(h.entries, j+1):