Skip to content

Commit

Permalink
Hot Reload: fix new global not initialized (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao authored Dec 10, 2024
1 parent d830381 commit 07ead74
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,12 +896,16 @@ h_bool hl_module_patch( hl_module *m1, hl_code *c ) {
hl_module_add(m2);

// call entry point (will only update types)
if( m2->functions_ptrs[c->entrypoint] ) {
vclosure cl;
cl.t = c->functions[m2->functions_indexes[c->entrypoint]].type;
cl.fun = m2->functions_ptrs[c->entrypoint];
cl.hasValue = 0;
hl_dyn_call(&cl,NULL,0);
for(i=modules_count-1;i>=0;i--) {
hl_module *m = cur_modules[i];
if( m->functions_ptrs[m->code->entrypoint] ) {
vclosure cl;
cl.t = m->code->functions[m->functions_indexes[m->code->entrypoint]].type;
cl.fun = m->functions_ptrs[m->code->entrypoint];
cl.hasValue = 0;
hl_dyn_call(&cl,NULL,0);
break;
}
}

return true;
Expand Down

0 comments on commit 07ead74

Please sign in to comment.