Beispiel #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();
			}
		}
Beispiel #2
0
		private void EmitListIn(FleeILGenerator ilg, IServiceProvider services, BranchManager bm)
		{
			var ce = new CompareElement();
			var endLabel = bm.FindLabel("endLabel");
			var trueTerminal = bm.FindLabel("trueTerminal");

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

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

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

			// Emit the compares
			foreach (var 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);
		}