Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement at_pos_boxed in VMArray.
  • Loading branch information
arnsholt committed Mar 5, 2013
1 parent dda02aa commit 30d0f65
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/6model/reprs/VMArray.c
Expand Up @@ -224,13 +224,24 @@ static void at_pos_native(PARROT_INTERP, STable *st, void *data, INTVAL index, N
}

static PMC *at_pos_boxed(PARROT_INTERP, STable *st, void *data, INTVAL index) {
VMArrayBody *body = (VMArrayBody *) data;
VMArrayREPRData *repr_data = (VMArrayREPRData *) st->REPR_data;
PMC **objs = (PMC **) body->slots;

if(!repr_data->elem_size)
die_no_native(interp, "set");

This comment has been minimized.

Copy link
@kboga

kboga Mar 5, 2013

Contributor

'die_no_native' should be 'die_no_boxed' methinks (bind_pos_native also seems to have it swapped)

This comment has been minimized.

Copy link
@arnsholt

arnsholt Mar 6, 2013

Author Contributor

Derp. And several other brainos to go with that. Thanks for spotting it!


/* TODO */
return PMCNULL;
if(pos < 0) {

This comment has been minimized.

Copy link
@kboga

kboga Mar 5, 2013

Contributor

'pos' isn't declared before, should be index perhaps?

This comment has been minimized.

Copy link
@arnsholt

arnsholt Mar 6, 2013

Author Contributor

Indeed it should. I forgot to compile and test after this change, it turns out. Thanks again!

pos += body->elems;
if(pos < 0)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_OUT_OF_BOUNDS,
"VMArray: index out of bounds");
}
else if(pos >= body->elems) {
return PMCNULL;
}

return objs[index];
}

static void bind_pos_native(PARROT_INTERP, STable *st, void *data, INTVAL index, NativeValue *value) {
Expand Down

0 comments on commit 30d0f65

Please sign in to comment.