Skip to content

Grammar rule *parameter_modifier* disallows valid V7 constructs #1209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: draft-v8
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions standard/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,8 @@ default_argument

parameter_modifier
: parameter_mode_modifier
| 'this'
| 'this' parameter_mode_modifier?
| parameter_mode_modifier? 'this'
;

parameter_mode_modifier
Expand Down Expand Up @@ -3054,8 +3055,9 @@ class Customer

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:

- It may only be an input parameter if it has a value type
- It may only be a reference parameter if it has a value type or has a generic type constrained to struct
- It may only be an input parameter if it has a value type.
- It may only be a reference parameter if it has a value type or has a generic type constrained to struct.
- It shall not be an output parameter.
- It shall not be a pointer type.

> *Example*: The following is an example of a static class that declares two extension methods:
Expand Down
Loading