Mercurial > projects > ldc
diff dmd/mtype.c @ 127:facc562f5674 trunk
[svn r131] Fixed #11
All associative array properties now work as they should.
Fixed problems with some cases of array.length and array.ptr.
Fixed some problems with array properties.
Fixed 'in' contracts.
author | lindquist |
---|---|
date | Fri, 30 Nov 2007 12:56:52 +0100 |
parents | 9c79b61fb638 |
children | a7dfa0ed966c |
line wrap: on
line diff
--- a/dmd/mtype.c Wed Nov 28 05:04:38 2007 +0100 +++ b/dmd/mtype.c Fri Nov 30 12:56:52 2007 +0100 @@ -1513,9 +1513,8 @@ static char *name[2] = { "_adReverseChar", "_adReverseWchar" }; nm = name[n->ty == Twchar]; - fd = FuncDeclaration::genCfunc(Type::tindex, nm); + fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), nm); fd->llvmRunTimeHack = true; - ((TypeFunction*)fd->type)->llvmRetInPtr = true; ec = new VarExp(0, fd); e = e->castTo(sc, n->arrayOf()); // convert to dynamic array arguments = new Expressions(); @@ -1532,9 +1531,8 @@ static char *name[2] = { "_adSortChar", "_adSortWchar" }; nm = name[n->ty == Twchar]; - fd = FuncDeclaration::genCfunc(Type::tindex, nm); + fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), nm); fd->llvmRunTimeHack = true; - ((TypeFunction*)fd->type)->llvmRetInPtr = true; ec = new VarExp(0, fd); e = e->castTo(sc, n->arrayOf()); // convert to dynamic array arguments = new Expressions(); @@ -1552,9 +1550,8 @@ assert(size); dup = (ident == Id::dup); - fd = FuncDeclaration::genCfunc(Type::tindex, dup ? Id::adDup : Id::adReverse); + fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), dup ? Id::adDup : Id::adReverse); fd->llvmRunTimeHack = true; - ((TypeFunction*)fd->type)->llvmRetInPtr = true; ec = new VarExp(0, fd); e = e->castTo(sc, n->arrayOf()); // convert to dynamic array arguments = new Expressions(); @@ -1572,10 +1569,9 @@ FuncDeclaration *fd; Expressions *arguments; - fd = FuncDeclaration::genCfunc(tint32->arrayOf(), + fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), (char*)(n->ty == Tbit ? "_adSortBit" : "_adSort")); fd->llvmRunTimeHack = true; - ((TypeFunction*)fd->type)->llvmRetInPtr = true; ec = new VarExp(0, fd); e = e->castTo(sc, n->arrayOf()); // convert to dynamic array arguments = new Expressions(); @@ -2277,6 +2273,7 @@ Expressions *arguments; fd = FuncDeclaration::genCfunc(Type::tsize_t, Id::aaLen); + fd->llvmRunTimeHack = true; ec = new VarExp(0, fd); arguments = new Expressions(); arguments->push(e); @@ -2291,7 +2288,8 @@ int size = key->size(e->loc); assert(size); - fd = FuncDeclaration::genCfunc(Type::tindex, Id::aaKeys); + fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), Id::aaKeys); + fd->llvmRunTimeHack = true; ec = new VarExp(0, fd); arguments = new Expressions(); arguments->push(e); @@ -2305,12 +2303,13 @@ FuncDeclaration *fd; Expressions *arguments; - fd = FuncDeclaration::genCfunc(Type::tindex, Id::aaValues); + fd = FuncDeclaration::genCfunc(Type::tvoid->arrayOf(), Id::aaValues); + fd->llvmRunTimeHack = true; ec = new VarExp(0, fd); arguments = new Expressions(); arguments->push(e); size_t keysize = key->size(e->loc); - keysize = (keysize + 3) & ~3; // BUG: 64 bit pointers? + keysize = (keysize + 4 - 1) & ~(4 - 1); arguments->push(new IntegerExp(0, keysize, Type::tsize_t)); arguments->push(new IntegerExp(0, next->size(e->loc), Type::tsize_t)); e = new CallExp(e->loc, ec, arguments); @@ -2322,7 +2321,8 @@ FuncDeclaration *fd; Expressions *arguments; - fd = FuncDeclaration::genCfunc(Type::tint64, Id::aaRehash); + fd = FuncDeclaration::genCfunc(Type::tvoid->pointerTo(), Id::aaRehash); + fd->llvmRunTimeHack = true; ec = new VarExp(0, fd); arguments = new Expressions(); arguments->push(e->addressOf(sc));