Ejemplo n.º 1
0
        private static void EmitStringEquality(FleeILGenerator ilg, LogicalCompareOperation op, IServiceProvider services)
        {
            // Get the StringComparison from the options
            ExpressionOptions   options = (ExpressionOptions)services.GetService(typeof(ExpressionOptions));
            Int32LiteralElement ic      = new Int32LiteralElement((int)options.StringComparison);

            ic.Emit(ilg, services);

            // and emit the method call
            System.Reflection.MethodInfo mi = typeof(string).GetMethod("Equals", new Type[] { typeof(string), typeof(string), typeof(StringComparison) }, null);
            ilg.Emit(OpCodes.Call, mi);

            if (op == LogicalCompareOperation.NotEqual)
            {
                ilg.Emit(OpCodes.Ldc_I4_0);
                ilg.Emit(OpCodes.Ceq);
            }
        }
Ejemplo n.º 2
0
        private static void EmitStringEquality(YaleIlGenerator ilg, LogicalCompareOperation op, ExpressionContext context)
        {
            // Get the StringComparison from the options
            var options             = context.BuilderOptions;
            var int32LiteralElement = new Int32LiteralElement((int)options.StringComparison);

            int32LiteralElement.Emit(ilg, context);

            // and emit the method call
            var methodInfo = typeof(string).GetMethod("Equals", new[] { typeof(string), typeof(string), typeof(StringComparison) }, null);

            ilg.Emit(OpCodes.Call, methodInfo);

            if (op == LogicalCompareOperation.NotEqual)
            {
                ilg.Emit(OpCodes.Ldc_I4_0);
                ilg.Emit(OpCodes.Ceq);
            }
        }