mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
Lookup slot offset in reverse order to support shadowing fields.
Fixes issue #361.
This commit is contained in:
parent
b5a91955e8
commit
84edaf75a2
1 changed files with 5 additions and 2 deletions
7
eval.c
7
eval.c
|
@ -1952,10 +1952,13 @@ sexp sexp_type_slot_offset_op (sexp ctx , sexp self, sexp_sint_t n, sexp type, s
|
|||
len = 1;
|
||||
}
|
||||
len = sexp_vectorp(cpl) ? sexp_vector_length(cpl) : 1;
|
||||
for (i=0; i<len; i++)
|
||||
for (i=len-1; i>=0; --i)
|
||||
for (slots=sexp_type_slots(v[i]); sexp_pairp(slots); slots=sexp_cdr(slots), offset++)
|
||||
if (sexp_car(slots) == slot)
|
||||
if (sexp_car(slots) == slot) {
|
||||
while (--i>=0)
|
||||
offset += sexp_unbox_fixnum(sexp_length(ctx, sexp_type_slots(v[i])));
|
||||
return sexp_make_fixnum(offset);
|
||||
}
|
||||
return SEXP_FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue