aboutsummaryrefslogtreecommitdiff
path: root/typecheck.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-11 14:53:48 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-11 14:53:48 -0400
commitdb0d5a1c204fb48afa5e5a53cb3c703590645f8f (patch)
treee559f108bb3c198faa3863a32cbfe3402a3f4563 /typecheck.c
parent0b5bb32912cfc68c7783548006fca2dc5874eb93 (diff)
Change *:from_text() methods to return optional values and set up CLI
parsing to use that approach
Diffstat (limited to 'typecheck.c')
-rw-r--r--typecheck.c3
1 files changed, 2 insertions, 1 deletions
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;