[Build] Fixed ErrorHelper local variable

We need to emit a ldloca instruction before constructing the
ErrorHelper instance, in order to reference it in the finally
block below.
This commit is contained in:
thefiddler 2014-02-24 22:33:12 +01:00
parent 2f3e7a9493
commit 18ef634610

View file

@ -363,9 +363,9 @@ namespace OpenTK.Rewrite
vars.ErrorHelperLocal = new VariableDefinition(vars.ErrorHelperType);
// var helper = new ErrorHelper(GraphicsContext.CurrentContext);
// using (new ErrorHelper(GraphicsContext.CurrentContext)) { ...
il.Body.Variables.Add(vars.ErrorHelperLocal);
//il.Emit(OpCodes.Ldarga, vars.ErrorHelperLocal); // todo: fix this
il.Emit(OpCodes.Ldloca, vars.ErrorHelperLocal);
il.Emit(OpCodes.Call, vars.Get_CurrentContext);
il.Emit(OpCodes.Call, ctor);