aboutsummaryrefslogtreecommitdiff
path: root/interfaces.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-05-12 15:18:46 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-05-12 15:18:46 -0400
commit4dbe046866a6280cf304c7e0ec6471d872bc8e27 (patch)
tree293b94a73769a8fd10cdc5135a3af8da82c4d334 /interfaces.c
parent8ada56c4248e9e09b8f151e9d516739dd86ad520 (diff)
Add interface fields
Diffstat (limited to 'interfaces.c')
-rw-r--r--interfaces.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/interfaces.c b/interfaces.c
index a1f1e73f..db587cba 100644
--- a/interfaces.c
+++ b/interfaces.c
@@ -69,6 +69,8 @@ void compile_interface_def(env_t *env, ast_t *ast)
type_t *field_t = parse_type_ast(env, field_type);
if (field_t->tag == ClosureType)
field_t = Match(field_t, ClosureType)->fn;
+ if (field_t->tag != FunctionType)
+ field_t = Type(PointerType, .pointed=field_t);
CORD decl = compile_declaration(env, field_t, field->name);
CORD_appendf(&env->code->typecode, "%r%s;\n", decl,
field_t->tag == BoolType ? ":1" : "");