call ir_function_finalize on array accessors otherwise they'll blow up stuff

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-11 23:46:03 +01:00
parent cdb7d06521
commit 83438d9833
3 changed files with 9 additions and 5 deletions

6
ast.c
View file

@ -1160,12 +1160,14 @@ bool ast_local_codegen(ast_value *self, ir_function *func, bool param)
if (self->setter) {
if (!ast_global_codegen(self->setter, func->owner, false) ||
!ast_function_codegen(self->setter->constval.vfunc, func->owner))
!ast_function_codegen(self->setter->constval.vfunc, func->owner) ||
!ir_function_finalize(self->setter->constval.vfunc->ir_func))
return false;
}
if (self->getter) {
if (!ast_global_codegen(self->getter, func->owner, false) ||
!ast_function_codegen(self->getter->constval.vfunc, func->owner))
!ast_function_codegen(self->getter->constval.vfunc, func->owner) ||
!ir_function_finalize(self->getter->constval.vfunc->ir_func))
return false;
}
return true;

2
exec.c
View file

@ -1300,7 +1300,7 @@ while (1) {
if(!OPA->function || OPA->function >= (unsigned int)prog->functions_count)
{
qcvmerror(prog, "CALL outside the program in `%s`", prog->filename);
qcvmerror(prog, "CALL outside the program in `%s` (%i)", prog->filename, (int)OPA->function);
goto cleanup;
}

View file

@ -3586,7 +3586,8 @@ bool parser_finish(const char *output)
asvalue = (ast_value*)(parser->globals[i].var);
if (asvalue->setter) {
if (!ast_global_codegen(asvalue->setter, ir, false) ||
!ast_function_codegen(asvalue->setter->constval.vfunc, ir))
!ast_function_codegen(asvalue->setter->constval.vfunc, ir) ||
!ir_function_finalize(asvalue->setter->constval.vfunc->ir_func))
{
printf("failed to generate setter for %s\n", parser->globals[i].name);
ir_builder_delete(ir);
@ -3595,7 +3596,8 @@ bool parser_finish(const char *output)
}
if (asvalue->getter) {
if (!ast_global_codegen(asvalue->getter, ir, false) ||
!ast_function_codegen(asvalue->getter->constval.vfunc, ir))
!ast_function_codegen(asvalue->getter->constval.vfunc, ir) ||
!ir_function_finalize(asvalue->getter->constval.vfunc->ir_func))
{
printf("failed to generate getter for %s\n", parser->globals[i].name);
ir_builder_delete(ir);