Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Source/VSProj/Src/Tools/CodeTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,26 @@ unsafe MethodIdInfo getMethodId(MethodReference callee, MethodDefinition caller,
}
}

//修复out struct问题
for (int i = 0; i < method.Parameters.Count; i++)
{
var parameter = method.Parameters[i];
if (parameter.IsOut && parameter.ParameterType.GetElementType().IsValueType && !parameter.ParameterType.GetElementType().IsPrimitive)
{
code.Add(new Core.Instruction
{
Code = Core.Code.Ldarg,
Operand = i + (method.HasThis ? 1 : 0)
});
code.Add(new Core.Instruction
{
Code = Core.Code.Initobj,
Operand = addExternType(parameter.ParameterType.GetElementType())
});
offsetAdd += 2;
}
}

if (offsetAdd > 0)
{
var ilNewOffset = new Dictionary<Instruction, int>();
Expand Down