Mercurial > projects > ddmd
diff dmd/TypeInfoStructDeclaration.d @ 130:60bb0fe4563e
dmdfe 2.037 first main iteration
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Thu, 09 Sep 2010 22:51:44 +0100 |
parents | 1765f3ef917d |
children | 206db751bd4c |
line wrap: on
line diff
--- a/dmd/TypeInfoStructDeclaration.d Sun Sep 05 15:32:22 2010 +0400 +++ b/dmd/TypeInfoStructDeclaration.d Thu Sep 09 22:51:44 2010 +0100 @@ -5,7 +5,7 @@ import dmd.TY; import dmd.MOD; import dmd.Loc; -import dmd.Argument; +import dmd.Parameter; import dmd.STC; import dmd.TypeStruct; import dmd.TypeFunction; @@ -109,6 +109,24 @@ auto arg = new Argument(STC.STCin, tc.pointerTo(), null, null); } + arguments.push(arg); + tfeqptr = new TypeFunction(arguments, Type.tbool, 0, LINK.LINKd); + tfeqptr.mod = MODconst; + tfeqptr = cast(TypeFunction)tfeqptr.semantic(0, &sc); + } + + TypeFunction *tfcmpptr; + { + Scope sc; + auto arguments = new Arguments; +version(STRUCTTHISREF) { + // arg type is ref const T + auto arg = new Argument(STC.STCref, tc.constOf(), null, null); +} else { + // arg type is const T* + auto arg = new Argument(STC.STCin, tc.pointerTo(), null, null); +} + arguments.push(arg); tfeqptr = new TypeFunction(arguments, Type.tbool, 0, LINK.LINKd); tfeqptr.mod = MOD.MODconst; @@ -118,13 +136,13 @@ TypeFunction tfcmpptr; { scope Scope sc = new Scope(); - auto arguments = new Arguments; + auto arguments = new Parameters; version (STRUCTTHISREF) { // arg type is ref const T - auto arg = new Argument(STC.STCref, tc.constOf(), null, null); + auto arg = new Parameter(STC.STCref, tc.constOf(), null, null); } else { // arg type is const T* - auto arg = new Argument(STC.STCin, tc.pointerTo(), null, null); + auto arg = new Parameter(STC.STCin, tc.pointerTo(), null, null); } arguments.push(arg); @@ -147,23 +165,8 @@ else dtdword(pdt, 0); - s = search_function(sd, Id.eq); - fdx = s ? s.isFuncDeclaration() : null; - if (fdx) - { - //printf("test1 %s, %s, %s\n", fdx.toChars(), fdx.type.toChars(), tfeqptr.toChars()); - fd = fdx.overloadExactMatch(tfeqptr); - if (fd) - dtxoff(pdt, fd.toSymbol(), 0, TYM.TYnptr); - else - { - fd = fdx.overloadExactMatch(tfcmpptr); - if (fd) - fdx.error("must return bool, not int"); - //fdx.error("must be declared as extern (D) int %s(%s*)", fdx.toChars(), sd.toChars()); - dtdword(pdt, 0); - } - } + if (sd.eq) + dtxoff(pdt, sd.eq.toSymbol(), 0, TYnptr); else dtdword(pdt, 0);