diff dmd/Identifier.d @ 168:ceed63f310fb

stringtable, stringbuffer and freelist moved to Global
author korDen
date Thu, 30 Sep 2010 12:57:13 +0400
parents e28b18c23469
children af724d3510d7
line wrap: on
line diff
--- a/dmd/Identifier.d	Thu Sep 30 12:13:49 2010 +0400
+++ b/dmd/Identifier.d	Thu Sep 30 12:57:13 2010 +0400
@@ -4,10 +4,9 @@
 import dmd.TOK;
 import dmd.DYNCAST;
 import dmd.Lexer;
+import dmd.Global;
 import dmd.OutBuffer;
 
-import std.stdio : writef;
-
 class Identifier
 {
     TOK value;
@@ -21,7 +20,15 @@
 	
     bool equals(Object o)
 	{
-		return this is o || string_ == (cast(Identifier)o).toChars();		/// hack
+		if (this is o) {
+			return true;
+		}
+		
+		if (auto i = cast(Identifier)o) {
+			return string_ == i.string_;
+		}
+		
+		return false;
 	}
 	
     hash_t hashCode()
@@ -63,8 +70,7 @@
 	// BUG: these are redundant with Lexer::uniqueId()
     static Identifier generateId(string prefix)
 	{
-		static size_t i;
-		return generateId(prefix, ++i);
+		return generateId(prefix, ++global.i);
 	}
 	
     static Identifier generateId(string prefix, size_t i)