Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Changeset 1605:1d5721f9ae18

Show
Ignore:
Timestamp:
01/06/10 13:18:19 (2 years ago)
Author:
Leandro Lucarella <llucax@gmail.com>
branch:
default
Message:

[WIP] Merge DMD r251: bugzilla 111 (appending a dchar to a char[])
This patch needs some work in the code generation, because of the runtime
changes (functions "_d_arrayappendcd" and "_d_arrayappendwd" are added).

This doesn't affect existing code though, it just makes with patch
a little useless, because something like this:

char [] s;
s ~= '\u6211';

That failed to compile with a nice error message previously to this
change, now fails with and ugly error message (a failed assertion).

Apparently there is a regression introduced by this patch too, when
compiling Dil I get this assertion message:

ldc: /home/luca/tesis/ldc/gen/statements.cpp:132: virtual void ReturnStatement::toIR(IRState*): Assertion `p->topfunc()->getReturnType() == llvm::Type::getVoidTy(gIR->context())' failed.
0 ldc 0x08a91628

Thank god we have bisecting capabilities in VCSs now ;)
---

dmd/expression.c | 47 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 41 insertions(+), 6 deletions(-)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dmd/expression.c

    r1604 r1605  
    84218421    e2->rvalue(); 
    84228422 
     8423    Type *tb1next = tb1->nextOf(); 
     8424 
    84238425    if ((tb1->ty == Tarray) && 
    84248426    (tb2->ty == Tarray || tb2->ty == Tsarray) && 
    8425     e2->implicitConvTo(e1->type) 
    8426     //e1->type->next->equals(e2->type->next) 
     8427    (e2->implicitConvTo(e1->type) 
     8428#if DMDV2 
     8429     || tb2->nextOf()->implicitConvTo(tb1next) 
     8430#endif 
     8431    ) 
    84278432       ) 
    84288433    {   // Append array 
     
    84328437    } 
    84338438    else if ((tb1->ty == Tarray) && 
    8434     e2->implicitConvTo(tb1->nextOf()
     8439    e2->implicitConvTo(tb1next
    84358440       ) 
    84368441    {   // Append element 
    8437     e2 = e2->castTo(sc, tb1->nextOf()); 
     8442    e2 = e2->castTo(sc, tb1next); 
    84388443    type = e1->type; 
    84398444    e = this; 
    84408445    } 
     8446    else if (tb1->ty == Tarray && 
     8447    (tb1next->ty == Tchar || tb1next->ty == Twchar) && 
     8448    e2->implicitConvTo(Type::tdchar) 
     8449       ) 
     8450    {   // Append dchar to char[] or wchar[] 
     8451    e2 = e2->castTo(sc, Type::tdchar); 
     8452    type = e1->type; 
     8453    e = this; 
     8454 
     8455    /* Do not allow appending wchar to char[] because if wchar happens 
     8456     * to be a surrogate pair, nothing good can result. 
     8457     */ 
     8458    } 
    84418459    else 
    84428460    { 
    84438461    error("cannot append type %s to type %s", tb2->toChars(), tb1->toChars()); 
    8444     type = Type::tint32; 
    8445     e = this; 
     8462    e = new ErrorExp(); 
    84468463    } 
    84478464    return e; 
     
    84648481    if (e) 
    84658482    return e; 
     8483 
     8484#if DMDV2 
     8485    if (e1->op == TOKarraylength) 
     8486    { 
     8487    e = ArrayLengthExp::rewriteOpAssign(this); 
     8488    e = e->semantic(sc); 
     8489    return e; 
     8490    } 
     8491#endif 
    84668492 
    84678493    if (e1->op == TOKslice) 
     
    85318557    if (e) 
    85328558    return e; 
     8559 
     8560#if DMDV2 
     8561    if (e1->op == TOKarraylength) 
     8562    { 
     8563    e = ArrayLengthExp::rewriteOpAssign(this); 
     8564    e = e->semantic(sc); 
     8565    return e; 
     8566    } 
     8567#endif 
    85338568 
    85348569    if (e1->op == TOKslice) 
Copyright © 2008, LDC Development Team.