Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add op for checking if an attr has been initialized, thus exposing on…
…e of the recent REPR additions.
  • Loading branch information
jnthn committed Jul 7, 2011
1 parent ebe6acb commit 5c9cd12
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ops/nqp.ops
Expand Up @@ -353,6 +353,26 @@ inline op repr_bind_attr_str(in PMC, in PMC, in STR, in STR) :base_core {
"Can only use repr_bind_attr_str on a SixModelObject");
}

/*

=item repr_is_attr_initialized()

Checks if an attribute has been initialized. Puts a non-zero value
in $1 if so.

=cut

*/
inline op repr_is_attr_initialized(out INT, in PMC, in PMC, in STR) :base_core {
PMC *ch = decontainerize(interp, $3);
if ($2->vtable->base_type == smo_id)
$1 = REPR($2)->is_attribute_initialized(interp, $2, ch, $4, NO_HINT);
else
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Can only use repr_is_attr_initialized on a SixModelObject");
}


/*

=item type_check(obj, wanted_type)
Expand Down

0 comments on commit 5c9cd12

Please sign in to comment.