-
Notifications
You must be signed in to change notification settings - Fork 757
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
Added a function overload builder #1126
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1126 +/- ##
==========================================
+ Coverage 94.22% 94.30% +0.08%
==========================================
Files 329 330 +1
Lines 15904 16180 +276
Branches 14 14
==========================================
+ Hits 14985 15258 +273
- Misses 919 922 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
this.fixedParameterTypes.Clear(); | ||
foreach (TypeSymbol parameterType in parameterTypes) | ||
{ | ||
this.fixedParameterTypes.Add(parameterType); | ||
} |
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.
What's the benefit of using the builder here? The only places I can see it being used is to do a full replace - feels like it would be more straightforward to just do this.fixedParameterTypes = parameterTypes.ToImmutableArray();
similar to the way other props are being set.
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.
Mostly felt kind of weird to create a list and then throw it out immediately. There is also a slight memory optimization (likely not noticeable in any way) because we avoid an extra allocation from ToImmutableArray()
.
Refactored code that constructs all the function overloads to be more fluent. To support signature help (#284), I will need to update function metadata to have descriptions on indvidual overloads as well as add names and descriptions to each parameters. The previous pattern wouldn't support the additional information very well.
There are no functional changes in this PR.