Skip to content

Commit

Permalink
Fixed Ourpalm#298
Browse files Browse the repository at this point in the history
  • Loading branch information
liiir1985 committed May 25, 2022
1 parent 0d7fd01 commit 1f3a7cf
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ILRuntime/Runtime/Intepreter/ILIntepreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3546,6 +3546,11 @@ public object Run(ILMethod method, object instance, object[] p)
else
PushNull(objRef);
}
else
{
if (objRef->ObjectType >= ObjectTypes.Object)
mStack[objRef->Value] = ((CLRType)type).CreateDefaultInstance();
}
}
}

Expand Down
28 changes: 28 additions & 0 deletions TestCases/TestValueTypeBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,5 +523,33 @@ private TestStructB GetAttr()
return TestStructB.GetOne(a);
}
}

public static void UnitTest_10050()
{
// 热更工程使用
List<TestVector3NoBinding> structs = new List<TestVector3NoBinding>();
for (int i = 0; i < 5; i++)
{
TestVector3NoBinding t = new TestVector3NoBinding();
if (i % 2 != 0)
t.x = i;
structs.Add(t);
}
for (int i = 0; i < 5; i++)
{
var item = structs[i];
Console.WriteLine(item.x);
if (i % 2 != 0)
{
if (item.x != i)
throw new Exception();
}
else
{
if (item.x != 0)
throw new Exception();
}
}
}
}
}

0 comments on commit 1f3a7cf

Please sign in to comment.