From: matthewt Date: Wed, 17 Sep 2008 00:39:44 +0000 (+0000) Subject: move const wrap to using new function as well X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c1b7d95f0f2054d52b5febedda132c0d108a4711;p=p5sagit%2FDevel-Declare.git move const wrap to using new function as well git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-Declare@4814 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/Declare.xs b/Declare.xs index 7a6e43c..4eda199 100644 --- a/Declare.xs +++ b/Declare.xs @@ -340,10 +340,6 @@ static I32 dd_filter_realloc(pTHX_ int idx, SV *sv, int maxlen) STATIC OP *(*dd_old_ck_const)(pTHX_ OP*op); STATIC OP *dd_ck_const(pTHX_ OP *o) { - HV* is_declarator; - SV** is_declarator_pack_ref; - HV* is_declarator_pack_hash; - SV** is_declarator_flag_ref; int dd_flags; char* s; char tmpbuf[sizeof PL_tokenbuf]; @@ -352,34 +348,15 @@ STATIC OP *dd_ck_const(pTHX_ OP *o) { o = dd_old_ck_const(aTHX_ o); /* let the original do its job */ - is_declarator = get_hv("Devel::Declare::declarators", FALSE); - - is_declarator_pack_ref = hv_fetch(is_declarator, HvNAME(PL_curstash), - strlen(HvNAME(PL_curstash)), FALSE); - - if (!is_declarator_pack_ref || !SvROK(*is_declarator_pack_ref)) - return o; /* not a hashref */ - - is_declarator_pack_hash = (HV*) SvRV(*is_declarator_pack_ref); - /* don't try and look this up if it's not a string const */ if (!SvPOK(cSVOPo->op_sv)) return o; - is_declarator_flag_ref = hv_fetch( - is_declarator_pack_hash, SvPVX(cSVOPo->op_sv), - strlen(SvPVX(cSVOPo->op_sv)), FALSE - ); - - /* requires SvIOK as well as TRUE since flags not being an int is useless */ + dd_flags = dd_is_declarator(aTHX_ SvPVX(cSVOPo->op_sv)); - if (!is_declarator_flag_ref - || !SvIOK(*is_declarator_flag_ref) - || !SvTRUE(*is_declarator_flag_ref)) + if (dd_flags == -1) return o; - dd_flags = SvIVX(*is_declarator_flag_ref); - if (!(dd_flags & DD_HANDLE_NAME)) return o; /* if we're not handling name, method intuiting not an issue */