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





--- Comment #2 from Shin Fujishiro <rsi...@gmail.com>  2009-05-26 02:51:35 PDT 
---
Created an attachment (id=380)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=380)
Add .mangleof (DMD 2.030)

This patch adds .mangleof property to variables, functions, and templates.

Example and output:
--------------------
int var;
void foo();
template T(int n) {}
pragma(msg, var.mangleof);
pragma(msg, foo.mangleof);
pragma(msg, T!(42).mangleof);
--------------------
_D4test3vari
_D4test3fooFZv
4test10__T1TVi42Z
--------------------

BTW, you can't tell whether a parameter has the "in" parameter storage class
from .mangleof. The "in" storage class is not embedded in type mangling (by
spec). You may want to use this instead:
--------------------
import std.traits;
void foo(int a, in int b, ref int c);
enum b_stringof = ParameterTypeTuple!(foo)[1 .. 2].stringof;
pragma(msg, b_stringof);
--------------------
(in const(int))
--------------------
The slicing [1 .. 2] does the trick.

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

Reply via email to