mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Rename struct mrb_locals to struct mrb_lvinfo.
That stands for "local variable information".
This commit is contained in:
@@ -21,7 +21,7 @@ enum irep_pool_type {
|
||||
IREP_TT_FLOAT,
|
||||
};
|
||||
|
||||
struct mrb_locals {
|
||||
struct mrb_lvinfo { /* local variable info (name, idx) */
|
||||
mrb_sym name;
|
||||
uint16_t r;
|
||||
};
|
||||
@@ -37,7 +37,7 @@ typedef struct mrb_irep {
|
||||
const mrb_sym *syms;
|
||||
const struct mrb_irep **reps;
|
||||
|
||||
const struct mrb_locals *lv;
|
||||
const struct mrb_lvinfo *lv;
|
||||
/* debug info */
|
||||
struct mrb_irep_debug_info* debug_info;
|
||||
|
||||
|
||||
@@ -698,7 +698,7 @@ search_upvar(codegen_scope *s, mrb_sym id, int *idx)
|
||||
while (u && !MRB_PROC_CFUNC_P(u)) {
|
||||
const struct mrb_irep *ir = u->body.irep;
|
||||
uint_fast16_t n = ir->nlocals;
|
||||
const struct mrb_locals *v = ir->lv;
|
||||
const struct mrb_lvinfo *v = ir->lv;
|
||||
for (; n > 1; n --, v ++) {
|
||||
if (v->name == id) {
|
||||
*idx = v->r;
|
||||
@@ -3056,11 +3056,11 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *nlv)
|
||||
s->sp += node_len(nlv)+1; /* add self */
|
||||
s->nlocals = s->sp;
|
||||
if (nlv) {
|
||||
struct mrb_locals *lv;
|
||||
struct mrb_lvinfo *lv;
|
||||
node *n = nlv;
|
||||
size_t i = 0;
|
||||
|
||||
s->irep->lv = lv = (struct mrb_locals*)mrb_malloc(mrb, sizeof(struct mrb_locals)*(s->nlocals-1));
|
||||
s->irep->lv = lv = (struct mrb_lvinfo*)mrb_malloc(mrb, sizeof(struct mrb_lvinfo)*(s->nlocals-1));
|
||||
for (i=0, n=nlv; n; i++,n=n->cdr) {
|
||||
lv[i].name = lv_name(n);
|
||||
if (lv_name(n)) {
|
||||
|
||||
@@ -281,7 +281,7 @@ local_var_p(parser_state *p, mrb_sym sym)
|
||||
while (u && !MRB_PROC_CFUNC_P(u)) {
|
||||
const struct mrb_irep *ir = u->body.irep;
|
||||
uint_fast16_t n = ir->nlocals;
|
||||
const struct mrb_locals *v = ir->lv;
|
||||
const struct mrb_lvinfo *v = ir->lv;
|
||||
for (; n > 1; n --, v ++) {
|
||||
if (v->name == sym) return TRUE;
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ local_var_p(parser_state *p, mrb_sym sym)
|
||||
while (u && !MRB_PROC_CFUNC_P(u)) {
|
||||
const struct mrb_irep *ir = u->body.irep;
|
||||
uint_fast16_t n = ir->nlocals;
|
||||
const struct mrb_locals *v = ir->lv;
|
||||
const struct mrb_lvinfo *v = ir->lv;
|
||||
for (; n > 1; n --, v ++) {
|
||||
if (v->name == sym) return TRUE;
|
||||
}
|
||||
|
||||
+2
-2
@@ -397,11 +397,11 @@ static int
|
||||
read_lv_record(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, size_t *record_len, mrb_sym const *syms, uint32_t syms_len)
|
||||
{
|
||||
const uint8_t *bin = start;
|
||||
struct mrb_locals *lv;
|
||||
struct mrb_lvinfo *lv;
|
||||
ptrdiff_t diff;
|
||||
int i;
|
||||
|
||||
irep->lv = lv = (struct mrb_locals*)mrb_malloc(mrb, sizeof(struct mrb_locals) * (irep->nlocals - 1));
|
||||
irep->lv = lv = (struct mrb_lvinfo*)mrb_malloc(mrb, sizeof(struct mrb_lvinfo) * (irep->nlocals - 1));
|
||||
|
||||
for (i = 0; i + 1< irep->nlocals; ++i) {
|
||||
uint16_t const sym_idx = bin_to_uint16(bin);
|
||||
|
||||
Reference in New Issue
Block a user