mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
pull request issue 553
This commit is contained in:
+10
-4
@@ -2080,6 +2080,10 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv)
|
||||
p->nlocals = p->sp;
|
||||
p->ai = mrb->arena_idx;
|
||||
|
||||
//because of a potential bad memory access in case of gc let's allocate the irep right now
|
||||
mrb_add_irep(mrb, mrb->irep_len);
|
||||
mrb->irep[mrb->irep_len] = (mrb_irep *)mrb_malloc(mrb, sizeof(mrb_irep));
|
||||
|
||||
p->idx = mrb->irep_len++;
|
||||
p->filename = prev->filename;
|
||||
if (p->filename) {
|
||||
@@ -2093,10 +2097,12 @@ scope_finish(codegen_scope *s, int idx)
|
||||
{
|
||||
mrb_state *mrb = s->mrb;
|
||||
mrb_irep *irep;
|
||||
|
||||
mrb_add_irep(mrb, idx);
|
||||
irep = mrb->irep[idx] = (mrb_irep *)mrb_malloc(mrb, sizeof(mrb_irep));
|
||||
|
||||
|
||||
//Comment out these instructions already done in scope_new
|
||||
//mrb_add_irep(mrb, idx);
|
||||
//irep = mrb->irep[idx] = (mrb_irep *)mrb_malloc(mrb, sizeof(mrb_irep));
|
||||
irep = mrb->irep[idx];
|
||||
|
||||
irep->flags = 0;
|
||||
irep->idx = idx;
|
||||
if (s->iseq) {
|
||||
|
||||
Reference in New Issue
Block a user