shithub: mc

Download patch

ref: edd9a39b5350d707c1e0ff5d171766175a182886
parent: 78a29fd778b1eb2a6258116a194434452d521a80
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Jun 17 09:15:44 EDT 2015

Work around bug with labels.

    We should really fix this. For now, just do workaround.

--- a/libstd/htab.myr
+++ b/libstd/htab.myr
@@ -76,17 +76,19 @@
 	di = 0
 	h = hash(ht, k)
 	i = h & (ht.keys.len - 1)
-	while ht.hashes[i] != 0 && !ht.dead[i] && ht.hashes[i] != h
-:searchmore
-		di++
-		i = (h + di) & (ht.keys.len - 1)
-	;;
+	while true
+		while ht.hashes[i] != 0 && !ht.dead[i] && ht.hashes[i] != h
+			di++
+			i = (h + di) & (ht.keys.len - 1)
+		;;
 
-	if ht.hashes[i] == 0 || ht.dead[i]
-		-> `None
-	;;
-	if ht.eq(ht.keys[i], k)
-		goto searchmore
+		if ht.hashes[i] == 0 || ht.dead[i]
+			-> `None
+		;;
+		if ht.eq(ht.keys[i], k)
+			di++
+			i = (h + di) & (ht.keys.len - 1)
+		;;
 	;;
 	-> `Some i
 }