Weaver - ?: (#225)

* ?:

* Pauls suggestion

* Update Weaver.cs
This commit is contained in:
MichalPetryka 2019-01-02 19:26:05 +01:00 committed by vis2k
parent c8a0ddb6d3
commit 7d905626ae

View File

@ -643,14 +643,8 @@ static MethodDefinition GenerateReadFunction(TypeReference variable)
continue;
// mismatched ldloca/ldloc for struct/class combinations is invalid IL, which causes crash at runtime
if (variable.IsValueType)
{
worker.Append(worker.Create(OpCodes.Ldloca, 0));
}
else
{
worker.Append(worker.Create(OpCodes.Ldloc, 0));
}
OpCode opcode = variable.IsValueType ? OpCodes.Ldloca : OpCodes.Ldloc;
worker.Append(worker.Create(opcode, 0));
var readFunc = GetReadFunc(field.FieldType);
if (readFunc != null)