using System.Dynamic;
using System.Linq;
using System.Reflection;
+using System.Threading;
#if FEATURE_REFEMIT
using System.Reflection.Emit;
#endif
public delegate void ActionRef<T0, T1>(ref T0 arg0, ref T1 arg1);
public static class CompilerHelpers {
- public static readonly MethodAttributes PublicStatic = MethodAttributes.Public | MethodAttributes.Static;
- private static readonly MethodInfo _CreateInstanceMethod = typeof(ScriptingRuntimeHelpers).GetMethod("CreateInstance");
+ public const MethodAttributes PublicStatic = MethodAttributes.Public | MethodAttributes.Static;
+ private static MethodInfo _CreateInstanceMethod;
private static int _Counter; // for generating unique names for lambda methods
if (mb.IsGenericMethod) {
MethodInfo mi = mb as MethodInfo;
- if (mi.GetGenericMethodDefinition() == _CreateInstanceMethod) {
+ if (_CreateInstanceMethod == null)
+ Interlocked.CompareExchange (ref _CreateInstanceMethod, typeof(ScriptingRuntimeHelpers).GetMethod ("CreateInstance"), null);
+
+ if (mi.GetGenericMethodDefinition() == _CreateInstanceMethod) {
return true;
}
}
)
);
}
-
+#if !MONO_INTERPRETER
#region Factories
#if !FEATURE_NUMERICS
[CLSCompliant(false)]
#endif
#endregion
+#endif
}
}