diff dmd/BinExp.d @ 178:e3afd1303184

Many small bugs fixed Made all classes derive from TObject to detect memory leaks (functionality is disabled for now) Began work on overriding backend memory allocations (to avoid memory leaks)
author korDen
date Sun, 17 Oct 2010 07:42:00 +0400
parents fa9a71a9f5a8
children cd48cb899aee
line wrap: on
line diff
--- a/dmd/BinExp.d	Sun Oct 10 10:38:55 2010 +0400
+++ b/dmd/BinExp.d	Sun Oct 17 07:42:00 2010 +0400
@@ -394,6 +394,8 @@
 
     this(Loc loc, TOK op, int size, Expression e1, Expression e2)
 	{
+		register();
+
 		super(loc, op, size);
 		this.e1 = e1;
 		this.e2 = e2;
@@ -1485,8 +1487,9 @@
 
 		/* Look up name in hash table
 		 */
-		StringValue* sv = global.arrayfuncs.update(name[0..namelen]);
-		FuncDeclaration fd = cast(FuncDeclaration)sv.ptrvalue;
+        auto s = name[0..namelen];
+		Object* sv = global.arrayfuncs.update(s);
+		FuncDeclaration fd = cast(FuncDeclaration)*sv;
 		if (!fd)
 		{
 			/* Some of the array op functions are written as library functions,
@@ -1701,7 +1704,7 @@
 				 */
 				TypeFunction ftype = new TypeFunction(fparams, type, 0, LINKc);
 				//printf("ftype: %s\n", ftype.toChars());
-				fd = new FuncDeclaration(Loc(0), Loc(0), Lexer.idPool(name[0..namelen]), STCundefined, ftype);
+				fd = new FuncDeclaration(Loc(0), Loc(0), Lexer.idPool(s), STCundefined, ftype);
 				fd.fbody = fbody;
 				fd.protection = PROT.PROTpublic;
 				fd.linkage = LINKc;
@@ -1720,9 +1723,9 @@
 			else
 			{   /* In library, refer to it.
 				 */
-				fd = FuncDeclaration.genCfunc(type, name[0..namelen]);
+				fd = FuncDeclaration.genCfunc(type, s);
 			}
-			sv.ptrvalue = cast(void*)fd;	// cache symbol in hash table
+			*sv = fd;	// cache symbol in hash table
 		}
 
 		/* Call the function fd(arguments)