comptime expandable match statements
This commit is contained in:
+2
-2
@@ -339,7 +339,7 @@ hide write_default func(writer Writer, $T type, value T) void ! WriteError {
|
||||
.pointer: try write_all(writer, value)
|
||||
.slice: try write_all(writer, value)
|
||||
.enum |enum_info|: {
|
||||
inline for enum_info.fields |field| {
|
||||
expand for enum_info.fields |field| {
|
||||
if value == field!(T, field.name) {
|
||||
try write_all(writer, ".")
|
||||
try write_all(writer, field.name)
|
||||
@@ -354,7 +354,7 @@ hide write_default func(writer Writer, $T type, value T) void ! WriteError {
|
||||
}
|
||||
|
||||
print func(writer Writer, $format []u8, $Args type, args Args) void ! WriteError {
|
||||
inline for parse_format(format.len, format, Args) |token| {
|
||||
expand for parse_format(format.len, format, Args) |token| {
|
||||
match token.kind {
|
||||
.unused: break
|
||||
.literal: try write_all(writer, format[token.start..token.end])
|
||||
|
||||
Reference in New Issue
Block a user