]> git.vpit.fr Git - perl/modules/Lexical-Types.git/blobdiff - Types.xs
Allow skipping declarations by returning an empty list from the mangler
[perl/modules/Lexical-Types.git] / Types.xs
index ebfb8a7f1376c939021de932b31334a7245d32b9..9baa8da22f7f4883d51adfaf13ed83f5fdc8621a 100644 (file)
--- a/Types.xs
+++ b/Types.xs
@@ -201,7 +201,11 @@ STATIC OP *lt_ck_padany(pTHX_ OP *o) {
    SPAGAIN;
    if (items > 2)
     croak(__PACKAGE__ " mangler should return zero, one or two scalars, but got %d", items);
-   if (items) {
+   if (items == 0) {
+    SvREFCNT_dec(orig_pkg);
+    SvREFCNT_dec(orig_meth);
+    goto skip;
+   } else {
     SV *rsv;
     if (items > 1) {
      rsv = POPs;
@@ -223,6 +227,7 @@ STATIC OP *lt_ck_padany(pTHX_ OP *o) {
   PL_ppaddr[OP_PADSV] = lt_pp_padsv;
  }
 
+skip:
  return o;
 }