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

Add PreferNonGenericVariantFor attribute and analyzer #5190

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tayrtahn
Copy link
Contributor

@Tayrtahn Tayrtahn commented May 31, 2024

Adds PreferNonGenericVariantForAttribute which can be used to mark that a users should prefer to use the specific, non-generic variant of a method when the generic type argument is one of the specified types.

Applies the new attribute to EntitySystem.TryComp<T> to show a warning when using it with TransformComponent or MetaDataComponent, since using the generic version in those cases will bypass the optimization of getting them from EntitySystem's cached transform and metadata queries.

Inspired by space-wizards/space-station-14#28133

Applying to TryComp:
Screenshot 2024-05-31 at 4 48 47 PM

Warning:
Screenshot 2024-05-31 at 4 39 52 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant