aboutsummaryrefslogtreecommitdiff
path: root/src/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-05 02:26:18 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-05 02:26:18 -0400
commit4299f6e24305d61e6c63b6312af1db887bfa864c (patch)
treeb413a254ad6b61f6bdc88f0e0419377135dcb03c /src/compile.c
parent486f2153e84f2b82ddffc601de75289cddb9c942 (diff)
More fixes
Diffstat (limited to 'src/compile.c')
-rw-r--r--src/compile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compile.c b/src/compile.c
index c7e02b3f..688901ac 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -4098,7 +4098,7 @@ CORD compile_top_level_code(env_t *env, ast_t *ast)
auto decl = Match(ast, Declare);
const char *decl_name = Match(decl->var, Var)->name;
CORD full_name = CORD_all(namespace_prefix(env, env->namespace), decl_name);
- type_t *t = get_type(env, decl->value);
+ type_t *t = decl->type ? parse_type_ast(env, decl->type) : get_type(env, decl->value);
if (t->tag == AbortType || t->tag == VoidType || t->tag == ReturnType)
code_err(ast, "You can't declare a variable with a ", type_to_str(t), " value");