diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptObjCode.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptObjCode.cs index bbdec99e18..b72806f138 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptObjCode.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptObjCode.cs @@ -163,8 +163,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine } finally { - if(objectTokens != null) - objectTokens.Close(); + objectTokens?.Close(); } // We enter all script event handler methods in the ScriptEventHandler table. diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptObjWriter.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptObjWriter.cs index de214e5997..0fda5338a0 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptObjWriter.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptObjWriter.cs @@ -64,11 +64,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine private static readonly Dictionary string2Type = PopulateS2T(); private static readonly Dictionary type2String = PopulateT2S(); - private static readonly MethodInfo monoGetCurrentOffset = typeof(ILGenerator).GetMethod("Mono_GetCurrentOffset", - BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, - new Type[] { typeof(ILGenerator) }, null); - - private static readonly OpCode[] opCodesLdcI4M1P8 = new OpCode[] { + private static readonly OpCode[] opCodesLdcI4M1P8 = new OpCode[] + { OpCodes.Ldc_I4_M1, OpCodes.Ldc_I4_0, OpCodes.Ldc_I4_1, OpCodes.Ldc_I4_2, OpCodes.Ldc_I4_3, OpCodes.Ldc_I4_4, OpCodes.Ldc_I4_5, OpCodes.Ldc_I4_6, OpCodes.Ldc_I4_7, OpCodes.Ldc_I4_8 }; @@ -394,11 +391,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine while(true) { // Get IL instruction offset at beginning of instruction. - offset = 0; - if((ilGen != null) && (monoGetCurrentOffset != null)) - { - offset = (int)monoGetCurrentOffset.Invoke(null, ilGenArg); - } + offset = ilGen is null ? 0 : ilGen.ILOffset; // Read and decode next internal format code from input file (.xmrobj file). ScriptObjWriterCode code = (ScriptObjWriterCode)objReader.ReadByte();