Make big_int_from_string return an error if not an integer.

This commit is contained in:
Jeroen van Rijn
2022-05-03 13:15:49 +02:00
parent 8bac82320f
commit 59f55a2119
3 changed files with 36 additions and 17 deletions
+5 -1
View File
@@ -177,7 +177,11 @@ ExactValue exact_value_typeid(Type *type) {
ExactValue exact_value_integer_from_string(String const &string) {
ExactValue result = {ExactValue_Integer};
big_int_from_string(&result.value_integer, string);
bool success;
big_int_from_string(&result.value_integer, string, &success);
if (!success) {
result = {ExactValue_Invalid};
}
return result;
}