diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-06-29 08:34:56 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 16:21:22 +0900 |
| commit | 3d8a38bea4de5ca3a65ec9bce9359b9c62326f9f (patch) | |
| tree | 3f8ebdcc96896f7cdde31064026ffa588c77776d /mrbgems/mruby-compiler/core/parse.y | |
| parent | 639946a006c29f648551512af8aa0bb0cd969412 (diff) | |
| download | mruby-3d8a38bea4de5ca3a65ec9bce9359b9c62326f9f.tar.gz mruby-3d8a38bea4de5ca3a65ec9bce9359b9c62326f9f.zip | |
You don't need to keep index in local variables info in `irep`.
Diffstat (limited to 'mrbgems/mruby-compiler/core/parse.y')
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 2ff66be60..c67c694fe 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -280,10 +280,12 @@ local_var_p(parser_state *p, mrb_sym sym) u = p->upper; while (u && !MRB_PROC_CFUNC_P(u)) { const struct mrb_irep *ir = u->body.irep; - uint_fast16_t n = ir->nlocals; - const struct mrb_lvinfo *v = ir->lv; - for (; v && n > 1; n--, v++) { - if (v->name == sym) return TRUE; + const mrb_sym *v = ir->lv; + int i; + + if (!v) break; + for (i=0; i < ir->nlocals; i++) { + if (v[i] == sym) return TRUE; } if (MRB_PROC_SCOPE_P(u)) break; u = u->upper; |
