-
Notifications
You must be signed in to change notification settings - Fork 139
Quick fix for NonAlloc API #784
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
Conversation
…name. Handle multiply declarations. Add more tests.
else | ||
{ | ||
newName = originName + "NonAlloc"; | ||
} |
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.
Move this section below the check for type, or we'll be doing this for every method invocation in the project.
var table = type.GetSymbolTable(expression.PsiModule).Filter( | ||
new AccessRightsFilter(new DefaultAccessContext(expression)), | ||
new ExactNameFilter(newName), | ||
new PredicateFilter(t => MatchSignatureAllocToNonAlloc(method, t.GetDeclaredElement() as IMethod))); |
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.
Is this heuristic good enough to capture all of the methods we need? Can we rely on naming and parameter size +1? Would it be easier to just have a map of allocating to non-allocating methods?
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.
How about instead of a dictionary for two known types, you have two dictionaries, one for Physics
and the other for Physics2D
? Each dictionary is a map of original name to new name, so we don't have to rely on ending with NonAlloc
Functions like SphereCast, RaycastAll, CapsuleCast e.t.c has NonAlloc version, analyzer generates warnings when user uses this functions. In some cases, where we can improve user code without unexpected affect quickfix is provided.