mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
added check for to_string in is_struct_with_default_print
The function wasn't checking if the struct had the method `to_string` which made it segfault when trying to override the default to_string on a struct
This commit is contained in:
committed by
Christoffer Lerno
parent
9b94c1dda9
commit
a58d782704
@@ -28,7 +28,8 @@ macro bool is_struct_with_default_print($Type)
|
||||
{
|
||||
return $Type.kindof == STRUCT
|
||||
&&& !$defined($Type.to_format)
|
||||
&&& !$defined($Type.to_new_string);
|
||||
&&& !$defined($Type.to_new_string)
|
||||
&&& !$defined($Type.to_string);
|
||||
}
|
||||
|
||||
<*
|
||||
@@ -529,4 +530,4 @@ fn usz! Formatter.print(&self, String str)
|
||||
}
|
||||
foreach (c : str) self.out(c)!;
|
||||
return self.idx;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user