Skip to content

Commit 2255429

Browse files
authored
[spec] .tupleof can be used on a struct/class type (#3824)
Don't list it under 'instance properties'. It gives a symbol sequence, which is an lvalue sequence when used on an instance. Add link to hidden fields.
1 parent e02ea34 commit 2255429

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

spec/class.dd

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ void foo(B b)
164164

165165
$(H2 $(LNAME2 class_properties, Class Properties))
166166

167+
$(TABLE2 Class Properties,
168+
$(THEAD Property, Description)
169+
$(TROW $(RELATIVE_LINK2 tupleof, `.tupleof`),
170+
Symbol sequence of fields in the class.)
171+
)
172+
167173
$(TABLE2 Class Instance Properties,
168174
$(THEAD Property, Description)
169175
$(TROW $(DDSUBLINK spec/property, classinfo, $(D .classinfo)),
@@ -172,16 +178,19 @@ $(TROW $(RELATIVE_LINK2 outer-property, `.outer`), $(ARGS For
172178
a nested class instance, provides either the parent class instance,
173179
or the parent function's context pointer when there is no parent
174180
class.))
175-
$(TROW $(D .tupleof), See below.)
176181
)
177182

178183
$(H3 $(LNAME2 tupleof, `.tupleof`))
179184

180-
$(P The $(D .tupleof) property is an
181-
$(DDSUBLINK spec/template, lvalue-sequences, lvalue sequence)
182-
of all the non-static fields in the class, excluding the hidden fields and
183-
the fields in the base class.)
185+
$(P The $(D .tupleof) property provides a symbol sequence
186+
of all the non-static fields in the class, excluding the
187+
$(RELATIVE_LINK2 hidden-fields, hidden fields) and
188+
the fields in the base class.
189+
When used on an instance, `.tupleof` gives an
190+
$(DDSUBLINK spec/template, lvalue-sequences, lvalue sequence).)
191+
184192
$(P The order of the fields in the tuple matches the order in which the fields are declared.)
193+
185194
$(NOTE `.tupleof` is not available for `extern(Objective-C)` classes due to
186195
their fields having a dynamic offset.
187196
)

spec/struct.dd

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -599,20 +599,14 @@ assert(u.c == false); // no overlap
599599
---
600600
)
601601

602-
$(H2 $(LNAME2 struct_properties, Struct Properties))
602+
$(H2 $(LEGACY_LNAME2 struct_instance_properties, struct_properties, Struct Properties))
603603

604-
$(TABLE2 Struct Type Properties,
604+
$(TABLE
605605
$(THEAD Name, Description)
606606
$(TROW $(D .alignof), Size boundary struct needs to be aligned on)
607-
)
608-
609-
$(H3 $(LNAME2 struct_instance_properties, Struct Instance Properties))
610-
611-
$(TABLE2 Struct Instance Properties,
612-
$(THEAD Name, Description)
613-
$(TROW $(D .tupleof), An $(DDSUBLINK spec/template, lvalue-sequences, lvalue sequence)
607+
$(TROW $(D .tupleof), A $(DDSUBLINK spec/template, variadic-templates, symbol sequence)
614608
of all struct fields - see
615-
$(DDSUBLINK spec/class, tupleof, here) for a class-based example.)
609+
$(DDSUBLINK spec/class, tupleof, class `.tupleof`) for more details.)
616610
)
617611

618612
$(H3 $(LNAME2 struct_field_properties, Struct Field Properties))

0 commit comments

Comments
 (0)