From dfd8f1411663861244ff3bf72b66f5ebf6f27839 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sat, 1 Dec 2012 15:23:40 +0100 Subject: [PATCH] function pointer's output types need to be set for the IR to know --- ast.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ast.c b/ast.c index 40a53a3..57a098f 100644 --- a/ast.c +++ b/ast.c @@ -1150,6 +1150,8 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir, bool isfield) } if (vtype == TYPE_FIELD) v->fieldtype = elemtype->next->expression.vtype; + if (vtype == TYPE_FUNCTION) + v->outtype = elemtype->next->expression.vtype; v->context = ast_ctx(self); array->ir_v = self->ir_v = v; @@ -1169,6 +1171,8 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir, bool isfield) } if (vtype == TYPE_FIELD) array->ir_values[ai]->fieldtype = elemtype->next->expression.vtype; + if (vtype == TYPE_FUNCTION) + array->ir_values[ai]->outtype = elemtype->next->expression.vtype; array->ir_values[ai]->context = ast_ctx(self); } mem_d(name); @@ -1203,6 +1207,8 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir, bool isfield) } if (vtype == TYPE_FIELD) v->fieldtype = elemtype->next->expression.vtype; + if (vtype == TYPE_FUNCTION) + v->outtype = elemtype->next->expression.vtype; v->context = ast_ctx(self); namelen = strlen(self->name); @@ -1221,6 +1227,8 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir, bool isfield) } if (vtype == TYPE_FIELD) self->ir_values[ai]->fieldtype = elemtype->next->expression.vtype; + if (vtype == TYPE_FUNCTION) + self->ir_values[ai]->outtype = elemtype->next->expression.vtype; self->ir_values[ai]->context = ast_ctx(self); } mem_d(name); @@ -1237,6 +1245,8 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir, bool isfield) } if (self->expression.vtype == TYPE_FIELD) v->fieldtype = self->expression.next->expression.vtype; + if (self->expression.vtype == TYPE_FUNCTION) + v->outtype = self->expression.next->expression.vtype; v->context = ast_ctx(self); } @@ -1334,6 +1344,8 @@ bool ast_local_codegen(ast_value *self, ir_function *func, bool param) } if (vtype == TYPE_FIELD) v->fieldtype = elemtype->next->expression.vtype; + if (vtype == TYPE_FUNCTION) + v->outtype = elemtype->next->expression.vtype; v->context = ast_ctx(self); namelen = strlen(self->name); @@ -1350,6 +1362,8 @@ bool ast_local_codegen(ast_value *self, ir_function *func, bool param) } if (vtype == TYPE_FIELD) self->ir_values[ai]->fieldtype = elemtype->next->expression.vtype; + if (vtype == TYPE_FUNCTION) + self->ir_values[ai]->outtype = elemtype->next->expression.vtype; self->ir_values[ai]->context = ast_ctx(self); } } @@ -1360,6 +1374,8 @@ bool ast_local_codegen(ast_value *self, ir_function *func, bool param) return false; if (self->expression.vtype == TYPE_FIELD) v->fieldtype = self->expression.next->expression.vtype; + if (self->expression.vtype == TYPE_FUNCTION) + v->outtype = self->expression.next->expression.vtype; v->context = ast_ctx(self); } -- 2.39.2