Skip to content

Commit 45f9070

Browse files
Grammar rule *parameter_modifier* disallows valid V7 constructs (#1209)
* fix grammar and add constraint * allow both modifier orders Co-authored-by: Nigel-Ecma <[email protected]> * add punctuation --------- Co-authored-by: Nigel-Ecma <[email protected]>
1 parent 3a7fd3d commit 45f9070

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

standard/classes.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,8 @@ default_argument
22132213
22142214
parameter_modifier
22152215
: parameter_mode_modifier
2216-
| 'this'
2216+
| 'this' parameter_mode_modifier?
2217+
| parameter_mode_modifier? 'this'
22172218
;
22182219
22192220
parameter_mode_modifier
@@ -3162,8 +3163,9 @@ class Customer
31623163
31633164
When the first parameter of a method includes the `this` modifier, that method is said to be an ***extension method***. Extension methods shall only be declared in non-generic, non-nested static classes. The first parameter of an extension method is restricted, as follows:
31643165
3165-
- It may only be an input parameter if it has a value type
3166-
- It may only be a reference parameter if it has a value type or has a generic type constrained to struct
3166+
- It may only be an input parameter if it has a value type.
3167+
- It may only be a reference parameter if it has a value type or has a generic type constrained to struct.
3168+
- It shall not be an output parameter.
31673169
- It shall not be a pointer type.
31683170
31693171
> *Example*: The following is an example of a static class that declares two extension methods:

0 commit comments

Comments
 (0)