comparison dmd/mtype.c @ 109:5ab8e92611f9 trunk

[svn r113] Added initial support for associative arrays (AAs). Fixed some problems with the string runtime support functions. Fixed initialization of array of structs. Fixed slice assignment where LHS is slice but RHS is dynamic array. Fixed problems with result of assignment expressions. Fixed foreach problems with key type mismatches.
author lindquist
date Wed, 21 Nov 2007 04:13:15 +0100
parents 288fe1029e1f
children 5880c12dba83
comparison
equal deleted inserted replaced
108:288fe1029e1f 109:5ab8e92611f9
1513 static char *name[2] = { "_adReverseChar", "_adReverseWchar" }; 1513 static char *name[2] = { "_adReverseChar", "_adReverseWchar" };
1514 1514
1515 nm = name[n->ty == Twchar]; 1515 nm = name[n->ty == Twchar];
1516 fd = FuncDeclaration::genCfunc(Type::tindex, nm); 1516 fd = FuncDeclaration::genCfunc(Type::tindex, nm);
1517 fd->llvmRunTimeHack = true; 1517 fd->llvmRunTimeHack = true;
1518 ((TypeFunction*)fd->type)->llvmRetInPtr = true;
1518 ec = new VarExp(0, fd); 1519 ec = new VarExp(0, fd);
1519 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array 1520 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
1520 arguments = new Expressions(); 1521 arguments = new Expressions();
1521 arguments->push(e); 1522 arguments->push(e);
1522 e = new CallExp(e->loc, ec, arguments); 1523 e = new CallExp(e->loc, ec, arguments);
1531 static char *name[2] = { "_adSortChar", "_adSortWchar" }; 1532 static char *name[2] = { "_adSortChar", "_adSortWchar" };
1532 1533
1533 nm = name[n->ty == Twchar]; 1534 nm = name[n->ty == Twchar];
1534 fd = FuncDeclaration::genCfunc(Type::tindex, nm); 1535 fd = FuncDeclaration::genCfunc(Type::tindex, nm);
1535 fd->llvmRunTimeHack = true; 1536 fd->llvmRunTimeHack = true;
1537 ((TypeFunction*)fd->type)->llvmRetInPtr = true;
1536 ec = new VarExp(0, fd); 1538 ec = new VarExp(0, fd);
1537 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array 1539 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
1538 arguments = new Expressions(); 1540 arguments = new Expressions();
1539 arguments->push(e); 1541 arguments->push(e);
1540 e = new CallExp(e->loc, ec, arguments); 1542 e = new CallExp(e->loc, ec, arguments);
1549 int dup; 1551 int dup;
1550 1552
1551 assert(size); 1553 assert(size);
1552 dup = (ident == Id::dup); 1554 dup = (ident == Id::dup);
1553 fd = FuncDeclaration::genCfunc(Type::tindex, dup ? Id::adDup : Id::adReverse); 1555 fd = FuncDeclaration::genCfunc(Type::tindex, dup ? Id::adDup : Id::adReverse);
1556 fd->llvmRunTimeHack = true;
1557 ((TypeFunction*)fd->type)->llvmRetInPtr = true;
1554 ec = new VarExp(0, fd); 1558 ec = new VarExp(0, fd);
1555 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array 1559 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
1556 arguments = new Expressions(); 1560 arguments = new Expressions();
1557 if (dup) 1561 if (dup)
1558 arguments->push(getTypeInfo(sc)); 1562 arguments->push(getTypeInfo(sc));
1569 Expressions *arguments; 1573 Expressions *arguments;
1570 1574
1571 fd = FuncDeclaration::genCfunc(tint32->arrayOf(), 1575 fd = FuncDeclaration::genCfunc(tint32->arrayOf(),
1572 (char*)(n->ty == Tbit ? "_adSortBit" : "_adSort")); 1576 (char*)(n->ty == Tbit ? "_adSortBit" : "_adSort"));
1573 fd->llvmRunTimeHack = true; 1577 fd->llvmRunTimeHack = true;
1578 ((TypeFunction*)fd->type)->llvmRetInPtr = true;
1574 ec = new VarExp(0, fd); 1579 ec = new VarExp(0, fd);
1575 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array 1580 e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
1576 arguments = new Expressions(); 1581 arguments = new Expressions();
1577 arguments->push(e); 1582 arguments->push(e);
1578 if (next->ty != Tbit) 1583 if (next->ty != Tbit)