From 898bee15817573b5ab865a1dae7e52da310affa8 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 9 Nov 2024 16:27:54 -0500 Subject: Introduce a `Match` struct to represent pattern matching results, which improves the usability of a lot of the APIs. Also bugfix some issues with ranges. --- stdlib/ranges.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'stdlib/ranges.c') diff --git a/stdlib/ranges.c b/stdlib/ranges.c index ae469bc4..3f673b52 100644 --- a/stdlib/ranges.c +++ b/stdlib/ranges.c @@ -38,10 +38,11 @@ static Text_t Range$as_text(const Range_t *r, bool use_color, const TypeInfo_t * (void)type; if (!r) return Text("Range"); - return Text$format(use_color ? "\x1b[0;1mRange\x1b[m(first=%r, last=%r, step=%r)" - : "Range(first=%r, last=%r, step=%r)", - Int$as_text(&r->first, use_color, &Int$info), Int$as_text(&r->last, use_color, &Int$info), - Int$as_text(&r->step, use_color, &Int$info)); + Text_t first = Int$as_text(&r->first, use_color, &Int$info); + Text_t last = Int$as_text(&r->last, use_color, &Int$info); + Text_t step = Int$as_text(&r->step, use_color, &Int$info); + return Text$format(use_color ? "\x1b[0;1mRange\x1b[m(first=%k, last=%k, step=%k)" + : "Range(first=%k, last=%k, step=%k)", &first, &last, &step); } PUREFUNC public Range_t Range$reversed(Range_t r) -- cgit v1.2.3