public ILEmitter Emit(ILEmitter il, Label gotoNext) { var arrayType = _variable.VariableType; var(arrayX, arrayY) = _arrayComparisonEmitter.EmitLoad(_variable, il, gotoNext); if (_configuration.Get(_variable.OwnerType).IgnoreCollectionOrder) { var elementType = arrayType.GetElementType(); var hasCustomComparer = _configuration.HasCustomComparer(elementType); il.EmitArraySorting(hasCustomComparer, elementType, arrayX, arrayY); } return(_arrayComparisonEmitter.EmitCompareArrays(il, arrayType, _variable.OwnerType, arrayX, arrayY, gotoNext)); }
public ILEmitter Emit(ILEmitter il, Label gotoNext) { var(x, y) = _arrayComparisonEmitter.EmitLoad(_variable, il, gotoNext); if (_configuration.Get(_variable.OwnerType).IgnoreCollectionOrder) { return(EmitCompareAsSortedArrays(il, gotoNext, x, y)); } var(xEnumerator, yEnumerator) = EmitLoadEnumerators(il, x, y); // todo: 1. think how to use try/finally block // the problem now with the inner `return` statements, it has to be `leave` instruction //il.BeginExceptionBlock(); Loop(il.DefineLabel(out var dispose), xEnumerator, yEnumerator, dispose); //il.BeginFinallyBlock(); EmitDisposeEnumerators(il.MarkLabel(dispose), xEnumerator, yEnumerator); //il.EndExceptionBlock(); return(il.Br(gotoNext)); }