comparison dmd/StringExp.d @ 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 fd4acc376c45
children 0d32fd48dac4
comparison
equal deleted inserted replaced
44:ea4769860460 45:ccbc1e0bb3f0
27 import dmd.backend.TYM; 27 import dmd.backend.TYM;
28 import dmd.backend.FL; 28 import dmd.backend.FL;
29 import dmd.backend.TYPE; 29 import dmd.backend.TYPE;
30 import dmd.backend.OPER; 30 import dmd.backend.OPER;
31 31
32 import dmd.Dsymbol : isExpression;
33
32 import core.memory; 34 import core.memory;
33 35
34 import core.stdc.string; 36 import core.stdc.string;
35 import core.stdc.stdlib; 37 import core.stdc.stdlib;
36 import core.stdc.ctype; 38 import core.stdc.ctype;
57 this.sz = 1; 59 this.sz = 1;
58 this.committed = 0; 60 this.committed = 0;
59 this.postfix = postfix; 61 this.postfix = postfix;
60 } 62 }
61 63
62 int equals(Object o) 64 bool equals(Object o)
63 { 65 {
64 assert(false); 66 Expression e;
67 //printf("StringExp.equals('%s')\n", o.toChars());
68 if (o && ((e = isExpression(o)) !is null))
69 {
70 if (e.op == TOKstring)
71 {
72 return compare(o) == 0;
73 }
74 }
75
76 return false;
65 } 77 }
66 78
67 string toChars() 79 string toChars()
68 { 80 {
69 scope OutBuffer buf = new OutBuffer(); 81 scope OutBuffer buf = new OutBuffer();