-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Properly populate ExportedType metadata table for forwarded extension blocks. #80361
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
return groupingTypes; | ||
} | ||
|
||
public sealed override ImmutableArray<Cci.ExportedType> GetExportedTypes(EmitContext context) |
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.
Consider passing EmitContext
as in
since it's a large structure. #Resolved
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.
Consider passing EmitContext as in since it's a large structure.
I'll stick to the current way of passing. As far as I can see in existing code, it is passed everywhere by value. If that becomes a real problem we would need to change all of them. Also, VB doesn't have a concept of in
, but this method is also overridden in VB.
|
||
while (stack.Count > currentStackSize) | ||
{ | ||
processTopItemFromStack(stack, context, builder); |
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.
Why are we processing the newly pushed types here immediately instead of processing them in the top-level loop? #Resolved
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.
Why are we processing the newly pushed types here immediately instead of processing them in the top-level loop?
Because we want to process them before we append grouping and marker types. And we want to append grouping and marker types before processing anything else from the stack. That ensures consistent ordering across all different forms of extensions representation.
using System.Reflection.Metadata; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading; | ||
using Microsoft.Cci; |
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.
This using looks unnecessary if we use Cci.
prefix in the code below. #Resolved
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.
This using looks unnecessary
IDE generated stubs for interface implementation and added this using in the process. That code doesn't use prefix.
internal override string? ExtensionMarkerName | ||
=> _underlyingType.ExtensionMarkerName; | ||
|
||
#nullable enable |
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.
This seems superfluous - there is already #nullable enable
a few lines above. #Pending
|
||
internal ImmutableArray<(Cci.INestedTypeReference GroupingType, ImmutableArray<Cci.INestedTypeReference> MarkerTypes)> GetExtensionGroupingAndMarkerTypesForTypeForwarding(EmitContext context) | ||
{ | ||
if (_lazyExtensionGroupingAndMarkerTypesForTypeForwarding.IsDefault) |
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 it guaranteed that this won't be called twice with a different EmitContext
(which could mean getting a stale cached value)? #Resolved
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 it guaranteed that this won't be called twice with a different EmitContext
No, but the actual implementation of the called APIs doesn't use the context.
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.
That sounds fragile to me. Consider mentioning that in a comment on the implementation side.
|
||
foreach (var groupingType in groupingTypes) | ||
{ | ||
var retargetedGroupingType = new ForwardedExtensionGroupingOrMarkerType(this.GetCciAdapter(), groupingType); |
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.
var retargetedGroupingType = new ForwardedExtensionGroupingOrMarkerType(this.GetCciAdapter(), groupingType); | |
var forwardedGroupingType = new ForwardedExtensionGroupingOrMarkerType(this.GetCciAdapter(), groupingType); | |
``` #Resolved |
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 current name looks fine to me
|
||
internal ImmutableArray<(Cci.INestedTypeReference GroupingType, ImmutableArray<Cci.INestedTypeReference> MarkerTypes)> GetExtensionGroupingAndMarkerTypesForTypeForwarding(EmitContext context) | ||
{ | ||
if (_lazyExtensionGroupingAndMarkerTypesForTypeForwarding.IsDefault) |
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.
That sounds fragile to me. Consider mentioning that in a comment on the implementation side.
Closes #79894.
Relates to test plan #76130