Skip to content
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

clarify what it means to refer to the augmented member by name in an augmenting member #3874

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Changes from 1 commit
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
7 changes: 6 additions & 1 deletion working/augmentation-libraries/feature-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,17 @@ Often, an augmentation wants to also preserve and run the code of the original
declaration it augments (hence the name "augmentation"). It may want run before
the original code, after it, or both. To allow that, we allow a new expression
syntax inside the bodies of augmenting members. Inside a member marked
`augment`, the expression `augmented` can be used to refer to the original
`augment`, the expression `augmented` can be used to refer to the augmented
function, getter, setter, or variable initializer. This is a contextual keyword
within `augment` members, and has no special meaning outside of that context.
See the next section for a full specification of what `augmented` actually
means, in the various contexts.

**Note:** Within an `augment` member, a reference to a member by the same name
refers to the final version of the member (and not the one being augmented). The
only way to reference the augmented member is through the `augmented`
expression.

The same declaration can be augmented multiple times by separate library
augmentations. When that happens, the merge order defined previously determines
which order the wrapping is applied.
Expand Down