Skip to content

Commit fed0eb5

Browse files
authored
Merge pull request #4274 from ntrel/uda-fix
[spec/attribute] Improve UDA docs
2 parents 50706eb + 7651f69 commit fed0eb5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

spec/attribute.dd

Lines changed: 9 additions & 9 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
@@ -1232,7 +1232,7 @@ $(H3 $(LNAME2 uda-usage, Usage))
12321232
)
12331233

12341234
$(P
1235-
Whether the attributes are values or types is up to the user, and whether later
1235+
Whether the attributes are values or symbols is up to the user, and whether later
12361236
attributes accumulate or override earlier ones is also up to how the user
12371237
interprets them.
12381238
)

0 commit comments

Comments
 (0)