Skip to content

Commit 70cf7a3

Browse files
committed
Fix processing TyepSpec in ldtoken
- Replicates #160 with the current approach. - Addresses nanoframework/Home#1164. - Add test code to TestApp.
1 parent fd6b2ab commit 70cf7a3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

MetadataProcessor.Shared/Tables/nanoTypeSpecificationsTable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private void FillTypeSpecsFromTypes()
190190
{
191191
foreach (var m in t.Methods.Where(i => i.HasBody))
192192
{
193-
foreach (var i in m.Body.Instructions.Where(i => (i.Operand is GenericParameter) || (i.OpCode.OperandType is OperandType.InlineType && ((TypeReference)i.Operand).IsArray)))
193+
foreach (var i in m.Body.Instructions.Where(i => (i.Operand is GenericParameter) || (i.OpCode.OperandType is OperandType.InlineType && ((TypeReference)i.Operand).IsArray) || (i.OpCode.OperandType is OperandType.InlineTok)))
194194
{
195195
// get index of signature for the TypeSpecification
196196
ushort signatureId;

MetadataProcessor.Tests/TestNFApp/Program.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,22 @@ public static void Main()
4646
// Generics Tests
4747
_ = new GenericClassTests();
4848

49+
///////////////////////////////////////////////////////////////////
50+
// Miscelaneous Tests
51+
MiscelaneousTests();
52+
4953
Debug.WriteLine("Exiting TestNFApp");
5054
}
5155

56+
private static void MiscelaneousTests()
57+
{
58+
var type = typeof(short[]);
59+
if (type.Name != "System.Int16[]")
60+
{
61+
throw new Exception("Type name is wrong, should be System.Int16[]");
62+
}
63+
}
64+
5265
public static void ReflectionTests()
5366
{
5467
Debug.WriteLine("++++++++++++++++++++++");

0 commit comments

Comments
 (0)