From eaaed25ea41d4ebefe569e35842c26fda10ffab9 Mon Sep 17 00:00:00 2001 From: heller Date: Fri, 27 Mar 2026 16:55:11 +0300 Subject: [PATCH] Fix ToString separators in ArrayValue.cs --- .../Compiler/Dataflow/ArrayValue.cs | 28 ++----------------- .../src/linker/Linker.Dataflow/ArrayValue.cs | 28 ++----------------- 2 files changed, 6 insertions(+), 50 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ArrayValue.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ArrayValue.cs index cab9d351cf6bb2..633d9f4b6d2512 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ArrayValue.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ArrayValue.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; using ILCompiler.Dataflow; using ILLink.Shared.DataFlow; @@ -108,35 +109,12 @@ public override string ToString() StringBuilder result = new(); result.Append("Array Size:"); result.Append(this.ValueToString(Size)); - result.Append(", Values:("); - bool first = true; - foreach (var element in IndexValues) - { - if (!first) - { - result.Append(','); - first = false; - } - result.Append('('); - result.Append(element.Key); - result.Append(",("); - bool firstValue = true; - foreach (var v in element.Value.Value.AsEnumerable()) - { - if (firstValue) - { - result.Append(','); - firstValue = false; - } + result.Append(string.Join(",", IndexValues.Select(element => + $"({element.Key},({string.Join(",", element.Value.Value.AsEnumerable())}))"))); - result.Append(v.ToString()); - } - result.Append("))"); - } result.Append(')'); - return result.ToString(); } } diff --git a/src/tools/illink/src/linker/Linker.Dataflow/ArrayValue.cs b/src/tools/illink/src/linker/Linker.Dataflow/ArrayValue.cs index e48b72ba6460a8..8f5ee39e39dc5b 100644 --- a/src/tools/illink/src/linker/Linker.Dataflow/ArrayValue.cs +++ b/src/tools/illink/src/linker/Linker.Dataflow/ArrayValue.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; using ILLink.Shared.DataFlow; using Mono.Cecil; @@ -107,35 +108,12 @@ public override string ToString() StringBuilder result = new(); result.Append("Array Size:"); result.Append(this.ValueToString(Size)); - result.Append(", Values:("); - bool first = true; - foreach (var element in IndexValues) - { - if (!first) - { - result.Append(','); - first = false; - } - result.Append('('); - result.Append(element.Key); - result.Append(",("); - bool firstValue = true; - foreach (var v in element.Value.Value.AsEnumerable()) - { - if (firstValue) - { - result.Append(','); - firstValue = false; - } + result.Append(string.Join(",", IndexValues.Select(element => + $"({element.Key},({string.Join(",", element.Value.Value.AsEnumerable())}))"))); - result.Append(v.ToString()); - } - result.Append("))"); - } result.Append(')'); - return result.ToString(); } }