From 72527630373270b3c3d84ce41f0e6ea0286ebd22 Mon Sep 17 00:00:00 2001 From: Jake Macdonald Date: Mon, 3 Jun 2024 17:34:07 +0000 Subject: [PATCH] clarify what it means to refer to the augmented member by name in an augmenting member --- working/augmentation-libraries/feature-specification.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/working/augmentation-libraries/feature-specification.md b/working/augmentation-libraries/feature-specification.md index b1c376d64..0a95c0035 100644 --- a/working/augmentation-libraries/feature-specification.md +++ b/working/augmentation-libraries/feature-specification.md @@ -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.