Skip to content

Commit 666ba9b

Browse files
authored
Merge pull request #3495 from WalterBright/fullyQualifiedName
add __traits(fullyQualifiedName)
2 parents 20c19ea + bc481b5 commit 666ba9b

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

spec/traits.dd

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ $(GNAME TraitsKeyword):
5353
$(RELATIVE_LINK2 hasCopyConstructor, $(D hasCopyConstructor))
5454
$(RELATIVE_LINK2 hasPostblit, $(D hasPostblit))
5555
$(RELATIVE_LINK2 identifier, $(D identifier))
56+
$(RELATIVE_LINK2 fullyQualifiedName, $(D fullyQualifiedName))
5657
$(RELATIVE_LINK2 getAliasThis, $(D getAliasThis))
5758
$(RELATIVE_LINK2 getAttributes, $(D getAttributes))
5859
$(RELATIVE_LINK2 getFunctionAttributes, $(D getFunctionAttributes))
@@ -1540,6 +1541,43 @@ export
15401541
public
15411542
)
15421543

1544+
$(H3 $(GNAME fullyQualifiedName))
1545+
1546+
$(P Takes one argument, which can be a type, expression, or symbol, and returns a string.)
1547+
1548+
$(UL
1549+
$(LI A $(D type) returns a string representing the type.)
1550+
$(LI A $(D expression) returns a string representing the type of the expression.)
1551+
$(LI A $(D symbol) returns a string representing the fully qualified name of the symbol.)
1552+
)
1553+
1554+
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
1555+
---
1556+
module plugh;
1557+
import std.stdio;
1558+
1559+
void main()
1560+
{
1561+
auto s = __traits(fullyQualifiedName, int);
1562+
writeln(s);
1563+
1564+
auto t = __traits(fullyQualifiedName, 1.0);
1565+
writeln(t);
1566+
1567+
auto u = __traits(fullyQualifiedName, t);
1568+
writeln(u);
1569+
}
1570+
---
1571+
)
1572+
1573+
Prints:
1574+
1575+
$(CONSOLE
1576+
int
1577+
double
1578+
plugh.main.t
1579+
)
1580+
15431581
$(H3 $(GNAME getProtection))
15441582

15451583
$(P A backward-compatible alias for $(GLINK getVisibility).)

0 commit comments

Comments
 (0)