Skip to content

Commit 0c53dd7

Browse files
committed
[spec] Add UDAs for parameters
1 parent a5baf7e commit 0c53dd7

6 files changed

Lines changed: 27 additions & 13 deletions

File tree

dlang.org.ddoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ _=
175175
GEN_DATETIME=$(DATETIME)
176176
GLINK=$(RELATIVE_LINK2 $0, $(I $0))
177177
GLINK2=$(DDSUBLINK spec/$1,$2,$(I $2))
178+
GLINK2_ALTTEXT=$(DDSUBLINK spec/$1,$2,$(I $3))
178179
GLOSSARY = $(HTTP dlang.org/glossary.html#$0, $0)
179180
GLOSSARY2 = $(HTTP dlang.org/glossary.html#$1, $2)
180181
GNAME=<a id="$0">$(SPANC gname, $0)</a>

ebook.ddoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ MODDEFFILE=<pre class="moddeffile">$0</pre><p></p>
4949
_=
5050

5151
GLINK2=$(GLINK $2)
52+
GLINK2_ALTTEXT=$(RELATIVE_LINK2 $2, $3)
5253
DDLINK=$(RELATIVE_LINK2 $2, $3)
5354
DDSUBLINK=$(RELATIVE_LINK2 $2, $3)
5455
DPLLINK=$(LINK2 https://dlang.org/$1, $2)

spec/attribute.dd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,9 @@ pragma(msg, __traits(getAttributes, typeof(a))); // prints tuple("hello")
783783
attributes accumulate or override earlier ones is also up to how the user
784784
interprets them.
785785
)
786+
$(P
787+
UDAs cannot be attached to template parameters.
788+
)
786789
$(SPEC_SUBNAV_PREV_NEXT property, Properties, pragma, Pragmas)
787790
)
788791

spec/expression.dd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,16 +1401,16 @@ $(H3 $(LNAME2 function_literals, Function Literals))
14011401

14021402
$(GRAMMAR
14031403
$(GNAME FunctionLiteral):
1404-
$(D function) $(GLINK2 declaration, Type)$(OPT) $(GLINK ParameterAttributes) $(OPT) $(GLINK FunctionLiteralBody)
1405-
$(D delegate) $(GLINK2 declaration, Type)$(OPT) $(GLINK ParameterMemberAttributes) $(OPT) $(GLINK FunctionLiteralBody)
1404+
$(D function) $(GLINK2 declaration, Type)$(OPT) $(GLINK ParameterWithAttributes) $(OPT) $(GLINK FunctionLiteralBody)
1405+
$(D delegate) $(GLINK2 declaration, Type)$(OPT) $(GLINK ParameterWithMemberAttributes) $(OPT) $(GLINK FunctionLiteralBody)
14061406
$(GLINK ParameterMemberAttributes) $(GLINK FunctionLiteralBody)
14071407
$(GLINK FunctionLiteralBody)
14081408
$(GLINK Lambda)
14091409

1410-
$(GNAME ParameterAttributes):
1410+
$(GNAME ParameterWithAttributes):
14111411
$(GLINK2 function, Parameters) $(GLINK2 function, FunctionAttributes)$(OPT)
14121412

1413-
$(GNAME ParameterMemberAttributes):
1413+
$(GNAME ParameterWithMemberAttributes):
14141414
$(GLINK2 function, Parameters) $(GLINK2 function, MemberFunctionAttributes)$(OPT)
14151415

14161416
$(GNAME FunctionLiteralBody):

spec/function.dd

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@ $(GNAME ParameterList):
3636
$(D ...)
3737

3838
$(GNAME Parameter):
39-
$(I InOut)$(OPT) $(GLINK2 declaration, BasicType) $(GLINK2 declaration, Declarator)
40-
$(I InOut)$(OPT) $(GLINK2 declaration, BasicType) $(GLINK2 declaration, Declarator) $(D ...)
41-
$(I InOut)$(OPT) $(GLINK2 declaration, BasicType) $(GLINK2 declaration, Declarator) = $(ASSIGNEXPRESSION)
42-
$(I InOut)$(OPT) $(GLINK2 declaration, Type)
43-
$(I InOut)$(OPT) $(GLINK2 declaration, Type) $(D ...)
39+
$(I ParameterAttributes)$(OPT) $(GLINK2 declaration, BasicType) $(GLINK2 declaration, Declarator)
40+
$(I ParameterAttributes)$(OPT) $(GLINK2 declaration, BasicType) $(GLINK2 declaration, Declarator) $(D ...)
41+
$(I ParameterAttributes)$(OPT) $(GLINK2 declaration, BasicType) $(GLINK2 declaration, Declarator) = $(ASSIGNEXPRESSION)
42+
$(I ParameterAttributes)$(OPT) $(GLINK2 declaration, Type)
43+
$(I ParameterAttributes)$(OPT) $(GLINK2 declaration, Type) $(D ...)
44+
45+
$(GNAME ParameterAttributes):
46+
$(I InOut)
47+
$(GLINK2 attribute, UserDefinedAttribute)
48+
$(I ParameterAttributes InOut)
49+
$(I ParameterAttributes) $(GLINK2 attribute, UserDefinedAttribute)
50+
$(I ParameterAttributes)
4451

4552
$(GNAME InOut):
46-
$(I InOutX)
47-
$(I InOut InOutX)
48-
49-
$(GNAME InOutX):
5053
$(D auto)
5154
$(GLINK2 declaration, TypeCtor)
5255
$(D final)
@@ -1413,6 +1416,11 @@ $(P Template functions and lambdas can deduce the `return` attribute.)
14131416

14141417
$(P `inout ref` parameters imply the `return` attribute.)
14151418

1419+
1420+
$(H3 $(LNAME2 udas-parameters, User-Defined Attributes for Parameters))
1421+
1422+
See also: $(GLINK2_ALTTEXT attribute, UserDefinedAttribute, User-Defined Attributes)
1423+
14161424
$(H3 $(LNAME2 variadic, Variadic Functions))
14171425

14181426
$(P Functions taking a variable number of arguments are called

spec/latex.ddoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ _=
9393

9494
GLINK=$(LINK2 $0, $(I $0))
9595
GLINK2=$(GLINK $2)
96+
GLINK2_ALTTEXT=$(LINK2 $2, $(I $3))
9697
GNAME={\fontshape{sl}\selectfont $0}
9798
_=
9899

0 commit comments

Comments
 (0)