changeset 45:ccbc1e0bb3f0

StringExp.equals implemented int equals(Object o) -> bool equals(Object o)
author korDen
date Sat, 21 Aug 2010 07:26:20 +0400
parents ea4769860460
children 0d32fd48dac4
files dmd/ComplexExp.d dmd/Dsymbol.d dmd/Expression.d dmd/FileName.d dmd/Identifier.d dmd/IntegerExp.d dmd/RealExp.d dmd/String.d dmd/StringExp.d dmd/TupleExp.d dmd/Type.d dmd/TypeTuple.d dmd/VarExp.d
diffstat 13 files changed, 26 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/ComplexExp.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/ComplexExp.d	Sat Aug 21 07:26:20 2010 +0400
@@ -32,7 +32,7 @@
 		//printf("ComplexExp.ComplexExp(%s)\n", toChars());
 	}
 
-	int equals(Object o)
+	bool equals(Object o)
 	{
 		assert(false);
 	}
--- a/dmd/Dsymbol.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/Dsymbol.d	Sat Aug 21 07:26:20 2010 +0400
@@ -167,7 +167,7 @@
 		return loc.toChars();
 	}
 
-    int equals(Object o)
+    bool equals(Object o)
 	{
 		assert(false);
 	}
--- a/dmd/Expression.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/Expression.d	Sat Aug 21 07:26:20 2010 +0400
@@ -174,7 +174,7 @@
 		type = null;
 	}
 
-	int equals(Object o)
+	bool equals(Object o)
 	{
 		return this is o;
 	}
--- a/dmd/FileName.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/FileName.d	Sat Aug 21 07:26:20 2010 +0400
@@ -89,7 +89,7 @@
 		return opCmp(obj) == 0;
 	}
 
-    static int equals(string name1, string name2)
+    static bool equals(string name1, string name2)
 	{
 		return compare(name1, name2) == 0;
 	}
--- a/dmd/Identifier.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/Identifier.d	Sat Aug 21 07:26:20 2010 +0400
@@ -18,7 +18,7 @@
 		this.value = value;
 	}
 	
-    int equals(Object o)
+    bool equals(Object o)
 	{
 		return this is o || string_ == (cast(Identifier)o).toChars();		/// hack
 	}
--- a/dmd/IntegerExp.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/IntegerExp.d	Sat Aug 21 07:26:20 2010 +0400
@@ -49,7 +49,7 @@
 		this.value = value;
 	}
 
-	int equals(Object o)
+	bool equals(Object o)
 	{
 		IntegerExp ne;
 
--- a/dmd/RealExp.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/RealExp.d	Sat Aug 21 07:26:20 2010 +0400
@@ -33,7 +33,7 @@
 		this.type = type;
 	}
 
-	int equals(Object o)
+	bool equals(Object o)
 	{
 		assert(false);
 	}
--- a/dmd/String.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/String.d	Sat Aug 21 07:26:20 2010 +0400
@@ -68,7 +68,7 @@
 		return str.length;
 	}
 
-    int equals(Object obj)
+    bool equals(Object obj)
 	{
 		return str == (cast(String)obj).str;
 	}
--- a/dmd/StringExp.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/StringExp.d	Sat Aug 21 07:26:20 2010 +0400
@@ -29,6 +29,8 @@
 import dmd.backend.TYPE;
 import dmd.backend.OPER;
 
+import dmd.Dsymbol : isExpression;
+
 import core.memory;
 
 import core.stdc.string;
@@ -59,9 +61,19 @@
 		this.postfix = postfix;
 	}
 
-	int equals(Object o)
+	bool equals(Object o)
 	{
-		assert(false);
+		Expression e;
+		//printf("StringExp.equals('%s')\n", o.toChars());
+		if (o && ((e = isExpression(o)) !is null))
+		{
+			if (e.op == TOKstring)
+			{
+				return compare(o) == 0;
+			}
+		}
+		
+		return false;
 	}
 
 	string toChars()
--- a/dmd/TupleExp.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/TupleExp.d	Sat Aug 21 07:26:20 2010 +0400
@@ -117,7 +117,7 @@
 		return new TupleExp(loc, arraySyntaxCopy(exps));
 	}
 
-	int equals(Object o)
+	bool equals(Object o)
 	{
 		TupleExp ne;
 
--- a/dmd/Type.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/Type.d	Sat Aug 21 07:26:20 2010 +0400
@@ -379,7 +379,7 @@
 		assert(false);
 	}
 
-    int equals(Object o)
+    bool equals(Object o)
 	{
 		Type t = cast(Type)o;
 		//printf("Type.equals(%s, %s)\n", toChars(), t.toChars());
--- a/dmd/TypeTuple.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/TypeTuple.d	Sat Aug 21 07:26:20 2010 +0400
@@ -90,7 +90,7 @@
 		return this;
 	}
 
-	int equals(Object o)
+	bool equals(Object o)
 	{
 		Type t;
 
--- a/dmd/VarExp.d	Sat Aug 21 07:21:54 2010 +0400
+++ b/dmd/VarExp.d	Sat Aug 21 07:26:20 2010 +0400
@@ -34,7 +34,7 @@
 		this.type = var.type;
 	}
 
-	int equals(Object o)
+	bool equals(Object o)
 	{
 		assert(false);
 	}