Skip to content

Commit f554e9b

Browse files
committed
[spec/attribute] Improve UDA docs
Fix link. Clarify accepted kinds of UDA to cover all possibilities. Tweak example.
1 parent f4c45f9 commit f554e9b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

spec/attribute.dd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ $(H2 $(LNAME2 uda, User-Defined Attributes))
11131113

11141114
$(GRAMMAR
11151115
$(GNAME UserDefinedAttribute):
1116-
$(D @ $(LPAREN)) $(GLINK2 expression, TemplateArgumentList) $(D $(RPAREN))
1116+
$(D @ $(LPAREN)) $(GLINK2 template, TemplateArgumentList) $(D $(RPAREN))
11171117
$(D @) $(GLINK2 template, TemplateSingleArgument)
11181118
$(D @) $(GLINK_LEX Identifier) $(D $(LPAREN)) $(GLINK2 expression, NamedArgumentList)$(OPT) $(D $(RPAREN))
11191119
$(D @) $(GLINK2 template, TemplateInstance)
@@ -1127,14 +1127,14 @@ $(GNAME UserDefinedAttribute):
11271127
)
11281128

11291129
A user-defined attribute is defined using:
1130-
* Compile-time expressions
1131-
* A named manifest constant
1132-
* A type name
1133-
* A type to instantiate using a compile-time argument list
1130+
* A list of one or more $(GLINK2 template, TemplateArgument)s
1131+
* A compile-time expression (matching the above grammar)
1132+
* A symbol identifier
1133+
* An expression (matching the above grammar) to invoke with an argument list at compile-time
11341134

11351135
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
11361136
---
1137-
@(3) int a; // value argument
1137+
@3 int a; // value attribute
11381138
@("string", 7) int b; // multiple values
11391139

11401140
// using compile-time constant
@@ -1148,8 +1148,8 @@ struct Bar
11481148
{
11491149
int x;
11501150
}
1151-
@Bar() int d; // type instance
1152-
@Bar(3) int e; // type instance using initializer
1151+
@Bar() int d; // type instance attribute
1152+
@Bar(3) int e; // type instance attribute using initializer
11531153
---
11541154
)
11551155
$(P For `e`, the attribute is an instance of struct `Bar` which is

0 commit comments

Comments
 (0)