From db0d5a1c204fb48afa5e5a53cb3c703590645f8f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 11 Sep 2024 14:53:48 -0400 Subject: Change *:from_text() methods to return optional values and set up CLI parsing to use that approach --- typecheck.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'typecheck.c') diff --git a/typecheck.c b/typecheck.c index e23ece88..c459b733 100644 --- a/typecheck.c +++ b/typecheck.c @@ -1364,7 +1364,8 @@ PUREFUNC bool is_constant(env_t *env, ast_t *ast) case Int: { auto info = Match(ast, Int); if (info->bits == IBITS_UNSPECIFIED) { - Int_t int_val = Int$from_text(Text$from_str(info->str), NULL); + Int_t int_val = Int$from_text(Text$from_str(info->str)); + if (int_val.small == 0) return false; // Failed to parse return (Int$compare_value(int_val, I(BIGGEST_SMALL_INT)) <= 0); } return true; -- cgit v1.2.3