#include "mop.h"
-NEEDS_KEY(name);
-NEEDS_KEY(body);
-NEEDS_KEY(methods);
-NEEDS_KEY(package);
-NEEDS_KEY(package_name);
-NEEDS_KEY(package_cache_flag);
-
static void
mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stash, HV *const map)
{
HV *symbols;
dSP;
- symbols = get_all_package_symbols(stash, TYPE_FILTER_CODE);
+ symbols = mop_get_all_package_symbols(stash, TYPE_FILTER_CODE);
(void)hv_iterinit(symbols);
while ( (coderef = hv_iternextsv(symbols, &method_name, &method_name_len)) ) {
SV *method_slot;
SV *method_object;
- if (!get_code_info(coderef, &cvpkg_name, &cv_name)) {
+ if (!mop_get_code_info(coderef, &cvpkg_name, &cv_name)) {
continue;
}
method_slot = *hv_fetch(map, method_name, method_name_len, TRUE);
if ( SvOK(method_slot) ) {
- SV *const body = mop_call0(aTHX_ method_slot, key_body); /* $method_object->body() */
+ SV *const body = mop_call0(aTHX_ method_slot, KEY_FOR(body)); /* $method_object->body() */
if ( SvROK(body) && ((CV *) SvRV(body)) == cv ) {
continue;
}
}
- method_metaclass_name = mop_call0(aTHX_ self, method_metaclass); /* $self->method_metaclass() */
+ method_metaclass_name = mop_call0(aTHX_ self, mop_method_metaclass); /* $self->method_metaclass() */
/*
$method_object = $method_metaclass->wrap(
EXTEND(SP, 8);
PUSHs(method_metaclass_name); /* invocant */
mPUSHs(newRV_inc((SV *)cv));
- PUSHs(associated_metaclass);
+ PUSHs(mop_associated_metaclass);
PUSHs(self);
- PUSHs(key_package_name);
+ PUSHs(KEY_FOR(package_name));
PUSHs(class_name);
- PUSHs(key_name);
+ PUSHs(KEY_FOR(name));
mPUSHs(newSVpv(method_name, method_name_len));
PUTBACK;
- call_sv(wrap, G_SCALAR | G_METHOD);
+ call_sv(mop_wrap, G_SCALAR | G_METHOD);
SPAGAIN;
method_object = POPs;
PUTBACK;
SV *self
PREINIT:
HV *const obj = (HV *)SvRV(self);
- SV *const class_name = HeVAL( hv_fetch_ent(obj, key_package, 0, hash_package) );
+ SV *const class_name = HeVAL( hv_fetch_ent(obj, KEY_FOR(package), 0, HASH_FOR(package)) );
HV *const stash = gv_stashsv(class_name, 0);
+ if (!stash) {
+ return;
+ }
UV const current = mop_check_package_cache_flag(aTHX_ stash);
- SV *const cache_flag = HeVAL( hv_fetch_ent(obj, key_package_cache_flag, TRUE, hash_package_cache_flag));
- SV *const map_ref = HeVAL( hv_fetch_ent(obj, key_methods, TRUE, hash_methods));
+ SV *const cache_flag = HeVAL( hv_fetch_ent(obj, KEY_FOR(package_cache_flag), TRUE, HASH_FOR(package_cache_flag)));
+ SV *const map_ref = HeVAL( hv_fetch_ent(obj, KEY_FOR(methods), TRUE, HASH_FOR(methods)));
PPCODE:
/* in $self->{methods} does not yet exist (or got deleted) */
if ( !SvROK(map_ref) || SvTYPE(SvRV(map_ref)) != SVt_PVHV ) {