Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Implement at_pos_boxed in VMArray.
- Loading branch information
Showing
1 changed file
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
arnsholt
Author
Contributor
|
||
|
|
||
| /* TODO */ | ||
| return PMCNULL; | ||
| if(pos < 0) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
arnsholt
Author
Contributor
|
||
| 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) { | ||
|
|
||
'die_no_native' should be 'die_no_boxed' methinks (bind_pos_native also seems to have it swapped)