Skip to content

Commit

Permalink
Fix variable definition order: keep orig vars first
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0ade committed Feb 3, 2020
1 parent 24aa6e2 commit ff1492a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Harmony/Internal/MethodPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ internal MethodInfo CreateReplacement()
{
try
{
var originalVariables = DeclareLocalVariables(source ?? original);
var privateVars = new Dictionary<string, LocalBuilder>();

LocalBuilder resultVariable = null;
Expand Down Expand Up @@ -110,7 +111,6 @@ internal MethodInfo CreateReplacement()
var skipOriginalLabel = il.DefineLabel();
var canHaveJump = AddPrefixes(privateVars, skipOriginalLabel);

var originalVariables = DeclareLocalVariables(source ?? original);
var copier = new MethodCopier(source ?? original, il, originalVariables);
foreach (var transpiler in transpilers)
copier.AddTranspiler(transpiler);
Expand Down

0 comments on commit ff1492a

Please sign in to comment.