-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Rename LifetimeAnnotationAttribute
to ScopedRefAttribute
and remove unnecessary members
#6325
Conversation
…ve unnecessary members
@cston for review |
### LifetimeAnnotationAttribute | ||
The `scoped` and `unscoped` annotations will be emitted into metadata via the type `System.Runtime.CompilerServices.LifetimeAttribute` attribute. This attribute will be matched by name meaning it does not need to appear in any specific assembly. | ||
### ScopedRefAttribute | ||
The `scoped` and `unscoped` annotations will be emitted into metadata via the type `System.Runtime.CompilerServices.ScopedRefAttribute` attribute. This attribute will be matched by name meaning it does not need to appear in any specific assembly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
``` | ||
|
||
The attribute uses `int` instead of `bool` to allow for future lifetime expansions in this space. | ||
|
||
The compiler will emit this attribute on the element targeted by the `scoped` or `unscoped` syntax. This is true for types, methods and parameters. This will only be emitted when the syntax causes the value to differ from its default state. For example `scoped out` will cause no attribute to be emitted. | ||
The compiler will emit this attribute on the element targeted by the `scoped` syntax. This is true for types, methods and parameters. This will only be emitted when the syntax causes the value to differ from its default state. For example `scoped out` will cause no attribute to be emitted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compiler will emit this attribute on the element targeted by the
scoped
syntax. This is true for types, methods and parameters.
The second sentence is incorrect since this only applies to parameters. Perhaps change the first two sentences to: "The compiler will emit this attribute on the scoped
parameter."
|
||
public LifetimeAnnotationAttribute(int value) | ||
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] | ||
public sealed class ScopedRefAttribute : Attribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internal
} | ||
} | ||
``` | ||
|
||
The attribute uses `int` instead of `bool` to allow for future lifetime expansions in this space. | ||
|
||
The compiler will emit this attribute on the element targeted by the `scoped` or `unscoped` syntax. This is true for types, methods and parameters. This will only be emitted when the syntax causes the value to differ from its default state. For example `scoped out` will cause no attribute to be emitted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relates to issue dotnet/roslyn#62838