File tree Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -1688,20 +1688,43 @@ $(GNAME WithStatement):
1688
1688
$(D with) $(D $(LPAREN)) $(GLINK2 template, TemplateInstance) $(D $(RPAREN)) $(PSSCOPE)
1689
1689
)
1690
1690
1691
- where *Expression* evaluates to a class reference or struct
1692
- instance.
1691
+ where *Expression* evaluates to one of:
1692
+
1693
+ $(UL
1694
+ $(LI a class reference)
1695
+ $(LI a struct instance)
1696
+ $(LI an enum instance)
1697
+ $(LI a pointer to one of the above)
1698
+ )
1699
+
1693
1700
Within the with body the referenced object is searched first for
1694
1701
identifier symbols.
1695
1702
1703
+ ---
1704
+ enum E { A, B }
1705
+
1706
+ void test(E e)
1707
+ {
1708
+ with (e) // affects the switch statement
1709
+ switch (e)
1710
+ {
1711
+ case A: // no need for E.A
1712
+ case B:
1713
+ default:
1714
+ break;
1715
+ }
1716
+ }
1717
+ ---
1718
+
1696
1719
$(P Below, if `ident` is a member of the type of `expression`, the $(I WithStatement):)
1697
1720
1698
- --------------
1721
+ ---
1699
1722
with (expression)
1700
1723
{
1701
1724
...
1702
1725
ident;
1703
1726
}
1704
- --------------
1727
+ ---
1705
1728
1706
1729
is semantically equivalent to:
1707
1730
You can’t perform that action at this time.
0 commit comments