[Issue 1339] Invariant/const-ness is broken by built-in array properties sort and reverse

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 6 13:33:55 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=1339


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #10 from Don <clugdbug at yahoo.com.au> 2010-05-06 13:33:54 PDT ---
Dunno why I bothered with this one, since we should just ditch .sort and
.reverse.
But anyway...

PATCH: expression.c  DotIdExp::semantic(), around line 6113.

    else if (t1b->ty == Tarray ||
             t1b->ty == Tsarray ||
             t1b->ty == Taarray)
    {   /* If ident is not a valid property, rewrite:
         *   e1.ident
         * as:
         *   .ident(e1)
         */
        TypeArray *tarr = (TypeArray *)t1b;
        if (ident == Id::sort && !tarr->next->isMutable()) {
            error(".sort only applies to mutable arrays");
            return new ErrorExp();
        }
        if (ident == Id::reverse && !tarr->next->isMutable()) {
            error(".reverse only applies to mutable arrays");
            return new ErrorExp();
        }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list