From dd54dbc144d4e1e423b028851a3c24c5fef12fb7 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sun, 19 Apr 2020 12:10:27 +0200 Subject: [PATCH] Disable IndexRangeTransform if the "C# 8 ranges" setting is disabled. --- ICSharpCode.Decompiler/IL/Transforms/IndexRangeTransform.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ICSharpCode.Decompiler/IL/Transforms/IndexRangeTransform.cs b/ICSharpCode.Decompiler/IL/Transforms/IndexRangeTransform.cs index 46e69000b..3a91f0d1d 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/IndexRangeTransform.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/IndexRangeTransform.cs @@ -16,11 +16,8 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System; using System.Diagnostics; using System.Linq; -using ICSharpCode.Decompiler.CSharp.Resolver; -using ICSharpCode.Decompiler.Semantics; using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.Decompiler.TypeSystem.Implementation; @@ -93,6 +90,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms void IStatementTransform.Run(Block block, int pos, StatementTransformContext context) { + if (!context.Settings.Ranges) + return; int startPos = pos; // The container length access may be a separate instruction, or it may be inline with the variable's use if (MatchContainerLengthStore(block.Instructions[pos], out ILVariable containerLengthVar, out ILVariable containerVar)) {