shithub: mc

Download patch

ref: 093716ff5e2ffe837793ba7c9239c64e22789ec0
parent: 6f2fe6bc22f5baeec9feb049cc434fb32e64c8ed
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jul 29 18:46:53 EDT 2017

Don't use tyhash for scoping.

	Soon enough, it's going to use a strict equality comparison,
	so that params from different scopes will be considered
	different.

	It's a step towards deduping.

--- a/parse/stab.c
+++ b/parse/stab.c
@@ -116,6 +116,18 @@
 	stabstkoff--;
 }
 
+ulong
+paramhash(void *p)
+{
+	return strhash(((Type*)p)->pname);
+}
+
+int
+parameq(void *a, void *b)
+{
+	return streq(((Type*)a)->pname, ((Type*)b)->pname);
+}
+
 Tyenv*
 mkenv()
 {
@@ -123,7 +135,7 @@
 
 	e = malloc(sizeof(Tyenv));
 	e->super = NULL;
-	e->tab = mkht(tyhash, tyeq);
+	e->tab = mkht(paramhash, parameq);
 	return e;
 }