Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
core.demangle: (Unlisted bug) - Parse the inout(T) type (a.k.a. Wild …
Browse files Browse the repository at this point in the history
…in the ABI).
  • Loading branch information
complexmath committed May 20, 2011
1 parent cbc43e7 commit 2cd59c4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/core/demangle.d
Expand Up @@ -727,6 +727,7 @@ private struct Demangle
}

// FuncAttrs
breakFuncAttrs:
while( 'N' == tok() )
{
next();
Expand Down Expand Up @@ -756,6 +757,13 @@ private struct Demangle
next();
put( "@safe " );
continue;
case 'g':
// NOTE: The inout parameter type is represented as "Ng",
// which makes it look like a FuncAttr. So if we
// see an "Ng" FuncAttr we know we're really in
// the parameter list. Rewind and break.
pos--;
break breakFuncAttrs;
default:
error();
}
Expand Down Expand Up @@ -868,7 +876,9 @@ private struct Demangle
case 'g': // Wild (Ng Type)
next();
// TODO: Anything needed here?
put( "inout(" );
parseType();
put( ")" );
return dst[beg .. len];
case 'e': // TypeNewArray (Ne Type)
next();
Expand Down Expand Up @@ -1457,7 +1467,8 @@ unittest
["_D8demangle13__T2fnVeeNANZ2fnFZv", "void demangle.fn!(real.nan).fn()"],
["_D8demangle14__T2fnVeeNINFZ2fnFZv", "void demangle.fn!(-real.infinity).fn()"],
["_D8demangle13__T2fnVeeINFZ2fnFZv", "void demangle.fn!(real.infinity).fn()"],
["_D8demangle21__T2fnVHiiA2i1i2i3i4Z2fnFZv", "void demangle.fn!([1:2, 3:4]).fn()"]
["_D8demangle21__T2fnVHiiA2i1i2i3i4Z2fnFZv", "void demangle.fn!([1:2, 3:4]).fn()"],
["_D8demangle2fnFNgiZNgi", "inout(int) demangle.fn(inout(int))"]
];

foreach( i, name; table )
Expand Down

0 comments on commit 2cd59c4

Please sign in to comment.