www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3334] New: std.demangle doesn't parse ref, pure, notrow

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3334

           Summary: std.demangle doesn't parse ref, pure, notrow
           Product: D
           Version: 2.032
          Platform: All
        OS/Version: Linux
            Status: NEW
          Keywords: patch
          Severity: minor
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: lutger.blijdestijn gmail.com


--- Comment #0 from Lutger <lutger.blijdestijn gmail.com> 2009-09-20 11:11:41
PDT ---
There are four 'attributes' defined in the ABI which std.demangle currently
doesn't parse: pure, nothrow, ref and property: 

import std.demangle;

void main()
{
    assert(demangle("_D3fooFNaNbZv") == "pure nothrow void foo()");
}

I've attached a patch (my first), feedback appreciated if something is not
right. 

I didn't know how property is supposed to be demangled, so that one is just
ignored. Also, this patch assumes all attributes are valid for functions and
delegates and just ignores attributes for calling conventions other that D.
Again, not sure if that's ok.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3334



--- Comment #1 from Lutger <lutger.blijdestijn gmail.com> 2009-09-20 11:21:53
PDT ---
Created an attachment (id=460)
support pure,ref,nothrow in std.demangle

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3334


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au
            Summary|std.demangle doesn't parse  |std.demangle doesn't parse
                   |ref, pure, notrow           |ref, pure, nothrow


--- Comment #2 from Don <clugdbug yahoo.com.au> 2009-09-20 11:27:25 PDT ---
(In reply to comment #0)
 I didn't know how property is supposed to be demangled, so that one is just
 ignored.

Congratulations, you've found the Easter egg! From the code in mtype.c, it's currently property. assert(demangle("_D3fooFNdNaNbZv") == " property pure nothrow void foo()"); Interesting, eh? But you're quite right to ignore it. It might well change. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3334


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3334



--- Comment #3 from Lutger <lutger.blijdestijn gmail.com> 2009-10-05 10:32:14
PDT ---
(In reply to comment #2)
 (In reply to comment #0)
 I didn't know how property is supposed to be demangled, so that one is just
 ignored.

Congratulations, you've found the Easter egg! From the code in mtype.c, it's currently property. assert(demangle("_D3fooFNdNaNbZv") == " property pure nothrow void foo()"); Interesting, eh? But you're quite right to ignore it. It might well change.

Very. Seeing the last release it should be changed to "pure nothrow void foo() property". I'm curious to see how the property / attribute thing pans out. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 05 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3334


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |kennytm gmail.com
         Resolution|                            |FIXED


--- Comment #4 from kennytm gmail.com 2011-04-23 02:16:46 PDT ---
Looks like this has been fixed.

--------------------------
module x;
import core.demangle, std.traits;

 property ref pure nothrow int foo(ref int z) {
    return z;
}
 safe void bar() {
}
 trusted void baz() {
}

void main() {
    assert(demangle(mangledName!foo) == "pure nothrow ref  property int
x.foo(ref int)");
    assert(demangle(mangledName!bar) == " safe void x.bar()");
    assert(demangle(mangledName!baz) == " trusted void x.baz()");
}
--------------------------

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