Пример #1
0
        private void ResolveForListSearch()
        {
            CompareElement ce = new CompareElement();

            // Validate that our operand is comparable to all elements in the list
            foreach (ExpressionElement argumentElement in MyArguments)
            {
                ce.Initialize(MyOperand, argumentElement, LogicalCompareOperation.Equal);
                ce.Validate();
            }
        }
Пример #2
0
        private void EmitListIn(FleeILGenerator ilg, IServiceProvider services, BranchManager bm)
        {
            CompareElement ce           = new CompareElement();
            Label          endLabel     = bm.FindLabel("endLabel");
            Label          trueTerminal = bm.FindLabel("trueTerminal");

            // Cache the operand since we will be comparing against it a lot
            LocalBuilder lb          = ilg.DeclareLocal(MyOperand.ResultType);
            int          targetIndex = lb.LocalIndex;

            MyOperand.Emit(ilg, services);
            Utility.EmitStoreLocal(ilg, targetIndex);

            // Wrap our operand in a local shim
            LocalBasedElement targetShim = new LocalBasedElement(MyOperand, targetIndex);

            // Emit the compares
            foreach (ExpressionElement argumentElement in MyArguments)
            {
                ce.Initialize(targetShim, argumentElement, LogicalCompareOperation.Equal);
                ce.Emit(ilg, services);

                EmitBranchToTrueTerminal(ilg, trueTerminal, bm);
            }

            ilg.Emit(OpCodes.Ldc_I4_0);
            ilg.Emit(OpCodes.Br_S, endLabel);

            bm.MarkLabel(ilg, trueTerminal);
            ilg.MarkLabel(trueTerminal);

            ilg.Emit(OpCodes.Ldc_I4_1);

            bm.MarkLabel(ilg, endLabel);
            ilg.MarkLabel(endLabel);
        }