]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - Magic.xs
Correctly bless UTF-8 transliteration op objects
[perl/modules/Variable-Magic.git] / Magic.xs
index 33fc60e70e295a065e1a990fa0f878c0621ca3a3..d579f9ee0e0f4ed31666cc4f9ba9f17add425c0a 100644 (file)
--- a/Magic.xs
+++ b/Magic.xs
@@ -391,6 +391,9 @@ typedef enum {
  OPc_COP,
 #if VMG_HAS_PERL(5, 21, 5)
  OPc_METHOP,
+#endif
+#if VMG_HAS_PERL(5, 21, 7)
+ OPc_UNOP_AUX,
 #endif
  OPc_MAX
 } opclass;
@@ -410,6 +413,9 @@ static const char *const vmg_opclassnames[] = {
  "B::COP",
 #if VMG_HAS_PERL(5, 21, 5)
  "B::METHOP",
+#endif
+#if VMG_HAS_PERL(5, 21, 7)
+ "B::UNOP_AUX",
 #endif
  NULL
 };
@@ -420,8 +426,13 @@ static opclass vmg_opclass(const OP *o) {
   return OPc_NULL;
 #endif
 
- if (o->op_type == 0)
+ if (o->op_type == 0) {
+#if VMG_HAS_PERL(5, 21, 7)
+  if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)
+   return OPc_COP;
+#endif
   return (o->op_flags & OPf_KIDS) ? OPc_UNOP : OPc_BASEOP;
+ }
 
  if (o->op_type == OP_SASSIGN)
   return ((o->op_private & OPpASSIGN_BACKWARDS) ? OPc_UNOP : OPc_BINOP);
@@ -462,7 +473,12 @@ static opclass vmg_opclass(const OP *o) {
   case OA_PADOP:
    return OPc_PADOP;
   case OA_PVOP_OR_SVOP:
-   return (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF)) ? OPc_SVOP : OPc_PVOP;
+   return (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF))
+#if defined(USE_ITHREADS) && VMG_HAS_PERL(5, 8, 9)
+           ? OPc_PADOP : OPc_PVOP;
+#else
+           ? OPc_SVOP : OPc_PVOP;
+#endif
   case OA_LOOP:
    return OPc_LOOP;
   case OA_COP:
@@ -486,6 +502,10 @@ static opclass vmg_opclass(const OP *o) {
 #if VMG_HAS_PERL(5, 21, 5)
   case OA_METHOP:
    return OPc_METHOP;
+#endif
+#if VMG_HAS_PERL(5, 21, 7)
+  case OA_UNOP_AUX:
+   return OPc_UNOP_AUX;
 #endif
  }