Skip to content

Commit

Permalink
Fixes #571 - field needs to be a one element array to indicate it's a…
Browse files Browse the repository at this point in the history
… variable length of data
  • Loading branch information
sotteson1 committed Aug 24, 2021
1 parent 65f86c4 commit 2c83a38
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/BaselineWinmd/Windows.Win32.winmd
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,19 @@ private BlobBuilder EncodeFieldSignature(string structName, SemanticModel model,
}
else
{
EncodeTypeSymbol(type, signatureEncoder);
var nativeType =
SyntaxUtils.GetNativeTypeNameFromAttributesLists(field.AttributeLists);

// See if this is a type that ends with an array that needs to be emitted as a 1-length array
// which means a variable-length array
if (nativeType != null && nativeType.EndsWith("[]") && !(type is IPointerTypeSymbol))
{
signatureEncoder.Array(s => EncodeTypeSymbol(type, signatureEncoder), h => h.Shape(1, new int[1] { 1 }.ToImmutableArray(), new int[1] { 0 }.ToImmutableArray()));
}
else
{
EncodeTypeSymbol(type, signatureEncoder);
}
}

return fieldSignature;
Expand Down

0 comments on commit 2c83a38

Please sign in to comment.