Skip to content

Commit

Permalink
还是简单处理,从第一条指令拦起
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Jan 2, 2017
1 parent 32bc438 commit 3f08feb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Assets/XLua/Src/Editor/Hotfix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static bool InjectMethod(AssemblyDefinition assembly, MethodDefinition method, i
bool statefulConstructor = (hotfixType == 1) && method.IsConstructor && !method.IsStatic;


var firstIns = method.IsConstructor ? method.Body.Instructions[2] : method.Body.Instructions[0];
var firstIns = method.Body.Instructions[0];
var processor = method.Body.GetILProcessor();

processor.InsertBefore(firstIns, processor.Create(OpCodes.Ldsfld, fieldReference));
Expand Down Expand Up @@ -341,7 +341,7 @@ static bool InjectGenericMethod(AssemblyDefinition assembly, MethodDefinition me

int param_start = method.IsStatic ? 0 : 1;
int param_count = method.Parameters.Count + param_start;
var firstIns = method.IsConstructor ? method.Body.Instructions[2] : method.Body.Instructions[0];
var firstIns = method.Body.Instructions[0];
var processor = method.Body.GetILProcessor();

processor.InsertBefore(firstIns, processor.Create(OpCodes.Ldsfld, fieldReference));
Expand Down

0 comments on commit 3f08feb

Please sign in to comment.