Skip to content

Commit

Permalink
A simple elems implementation for MVMContext REPR
Browse files Browse the repository at this point in the history
<jnthn>	lizmat: (.elems) looks like something we should be able to fix.
<lizmat> jnthn: fixing nqp::elems on an MVMContext, would be great
  • Loading branch information
salortiz committed Jun 28, 2016
1 parent bbf44ea commit cdad2e9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/6model/reprs/MVMContext.c
Expand Up @@ -104,8 +104,10 @@ static void bind_key(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void
}

static MVMuint64 elems(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data) {
MVM_exception_throw_adhoc(tc,
"MVMContext representation does not support elems");
MVMContextBody *body = (MVMContextBody *)data;
MVMFrame *frame = body->context;
MVMLexicalRegistry *lexical_names = frame->static_info->body.lexical_names;
return (MVMuint64) HASH_CNT(hash_handle, lexical_names);
}

static MVMint64 exists_key(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data, MVMObject *key) {
Expand Down

0 comments on commit cdad2e9

Please sign in to comment.