|
@@ -28,8 +28,9 @@ namespace Invercargill {
|
|
|
.replace(COLOUR_CATEGORY, ""));
|
|
|
}
|
|
|
|
|
|
- public static void print_enumerable_dump<T>(Enumerable<T> enumerable, TransformDelegate<T, string> stringifier, string additional_message = "", DebugOutputDelegate? output_func = null, bool formatting = true) {
|
|
|
+ public static void print_enumerable_dump<T>(Enumerable<T> enumerable, StringifyDelegate<T>? stringifier = null, string additional_message = "", DebugOutputDelegate? output_func = null, bool formatting = true) {
|
|
|
var output = get_delegate(output_func, formatting);
|
|
|
+ var to_str = stringifier ?? Operators.stringify<T>();
|
|
|
|
|
|
output("\n\n" + format_colour(COLOUR_DEBUG, "Invercargill enumerable debug dump: ") + format_colour(COLOUR_PROGRAM, additional_message) + "\n");
|
|
|
print_enumerable_info(enumerable.get_info(), 0, output_func, formatting);
|
|
@@ -37,7 +38,7 @@ namespace Invercargill {
|
|
|
var count = 0;
|
|
|
output(format_colour(COLOUR_DEBUG, "\nBegin iterating enumerable:\n"));
|
|
|
foreach (var item in enumerable) {
|
|
|
- output(format_colour(COLOUR_DEBUG, @" $count:\t") + format_colour(COLOUR_PROGRAM, stringifier(item)) + "\n");
|
|
|
+ output(format_colour(COLOUR_DEBUG, @" $count:\t") + format_colour(COLOUR_PROGRAM, to_str(item)) + "\n");
|
|
|
count++;
|
|
|
}
|
|
|
|
|
@@ -156,16 +157,16 @@ namespace Invercargill {
|
|
|
|
|
|
internal class TraceEnumerable<T> : Enumerable<T> {
|
|
|
private Enumerable<T> input;
|
|
|
- private TransformDelegate<T, string> stringifier;
|
|
|
+ private StringifyDelegate<T>? stringifier;
|
|
|
private string additional_message;
|
|
|
private DebugOutputDelegate? output_func;
|
|
|
private bool formatting;
|
|
|
private uint counter = 0;
|
|
|
|
|
|
- public TraceEnumerable(owned Enumerable<T> input, EnumerableInfo info, owned TransformDelegate<T, string> stringifier, string additional_message = "", owned DebugOutputDelegate? output_func, bool formatting) {
|
|
|
+ public TraceEnumerable(owned Enumerable<T> input, EnumerableInfo info, owned StringifyDelegate<T>? stringifier = null, string additional_message = "", owned DebugOutputDelegate? output_func, bool formatting) {
|
|
|
this.input = (owned)input;
|
|
|
this.additional_message = additional_message;
|
|
|
- this.stringifier = (owned)stringifier;
|
|
|
+ this.stringifier = (owned)stringifier ?? Operators.stringify<T>();
|
|
|
this.output_func = (owned)output_func;
|
|
|
this.formatting = formatting;
|
|
|
DebugPrinter.print_trace_registration(info, additional_message, output_func, formatting);
|