[svn:parrot] r49226 - in branches/string_macros: include/parrot src src/io src/ops src/pmc src/string src/string/encoding t/op

nwellnhof at svn.parrot.org nwellnhof at svn.parrot.org
Wed Sep 22 01:21:16 UTC 2010


Author: nwellnhof
Date: Wed Sep 22 01:21:16 2010
New Revision: 49226
URL: https://trac.parrot.org/parrot/changeset/49226

Log:
[str] Switch to STRING_index macro

Move the whole 'index' logic into the string vtable functions. This also
changes the index opcode to throw when the source string is null. If this
change causes problems, we can add a deprecation notice or revert it.

Modified:
   branches/string_macros/include/parrot/string.h
   branches/string_macros/src/io/api.c
   branches/string_macros/src/ops/core_ops.c
   branches/string_macros/src/ops/string.ops
   branches/string_macros/src/pmc.c
   branches/string_macros/src/pmc/codestring.pmc
   branches/string_macros/src/pmc/string.pmc
   branches/string_macros/src/pmc/stringbuilder.pmc
   branches/string_macros/src/pmc/sub.pmc
   branches/string_macros/src/string/api.c
   branches/string_macros/src/string/encoding/shared.c
   branches/string_macros/src/string/encoding/shared.h
   branches/string_macros/t/op/string.t

Modified: branches/string_macros/include/parrot/string.h
==============================================================================
--- branches/string_macros/include/parrot/string.h	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/include/parrot/string.h	Wed Sep 22 01:21:16 2010	(r49226)
@@ -90,8 +90,8 @@
 
 typedef INTVAL   (*str_vtable_equal_t)(PARROT_INTERP, ARGIN(const STRING *lhs), ARGIN(const STRING *rhs));
 typedef INTVAL   (*str_vtable_compare_t)(PARROT_INTERP, ARGIN(const STRING *lhs), ARGIN(const STRING *rhs));
-typedef INTVAL   (*str_vtable_index_t)(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search_string), UINTVAL offset);
-typedef INTVAL   (*str_vtable_rindex_t)(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search_string), UINTVAL offset);
+typedef INTVAL   (*str_vtable_index_t)(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search_string), INTVAL offset);
+typedef INTVAL   (*str_vtable_rindex_t)(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search_string), INTVAL offset);
 typedef size_t   (*str_vtable_hash_t)(PARROT_INTERP, ARGIN(const STRING *s), size_t hashval);
 typedef UINTVAL  (*str_vtable_validate_t)(PARROT_INTERP, ARGIN(const STRING *src));
 

Modified: branches/string_macros/src/io/api.c
==============================================================================
--- branches/string_macros/src/io/api.c	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/io/api.c	Wed Sep 22 01:21:16 2010	(r49226)
@@ -414,7 +414,7 @@
 
         orig_length = Parrot_str_byte_length(interp, result);
         GETATTR_StringHandle_read_offset(interp, pmc, offset);
-        newline_pos = Parrot_str_find_index(interp, result, CONST_STRING(interp, "\n"), offset);
+        newline_pos = STRING_index(interp, result, CONST_STRING(interp, "\n"), offset);
 
         /* No newline found, read the rest of the string. */
         if (newline_pos == -1)

Modified: branches/string_macros/src/ops/core_ops.c
==============================================================================
--- branches/string_macros/src/ops/core_ops.c	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/ops/core_ops.c	Wed Sep 22 01:21:16 2010	(r49226)
@@ -22761,84 +22761,84 @@
 opcode_t *
 Parrot_index_i_s_s(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (SREG(2) && SREG(3)) ? Parrot_str_find_index(interp, SREG(2), SREG(3), 0) : -1;
+    IREG(1) = (SREG(2) && SREG(3)) ? STRING_index(interp, SREG(2), SREG(3), 0) : -1;
 
 return (opcode_t *)cur_opcode + 4;}
 
 opcode_t *
 Parrot_index_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (CONST(2).u.string && SREG(3)) ? Parrot_str_find_index(interp, CONST(2).u.string, SREG(3), 0) : -1;
+    IREG(1) = (CONST(2).u.string && SREG(3)) ? STRING_index(interp, CONST(2).u.string, SREG(3), 0) : -1;
 
 return (opcode_t *)cur_opcode + 4;}
 
 opcode_t *
 Parrot_index_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (SREG(2) && CONST(3).u.string) ? Parrot_str_find_index(interp, SREG(2), CONST(3).u.string, 0) : -1;
+    IREG(1) = (SREG(2) && CONST(3).u.string) ? STRING_index(interp, SREG(2), CONST(3).u.string, 0) : -1;
 
 return (opcode_t *)cur_opcode + 4;}
 
 opcode_t *
 Parrot_index_i_sc_sc(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (CONST(2).u.string && CONST(3).u.string) ? Parrot_str_find_index(interp, CONST(2).u.string, CONST(3).u.string, 0) : -1;
+    IREG(1) = (CONST(2).u.string && CONST(3).u.string) ? STRING_index(interp, CONST(2).u.string, CONST(3).u.string, 0) : -1;
 
 return (opcode_t *)cur_opcode + 4;}
 
 opcode_t *
 Parrot_index_i_s_s_i(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (SREG(2) && SREG(3)) ? Parrot_str_find_index(interp, SREG(2), SREG(3), IREG(4)) : -1;
+    IREG(1) = (SREG(2) && SREG(3)) ? STRING_index(interp, SREG(2), SREG(3), IREG(4)) : -1;
 
 return (opcode_t *)cur_opcode + 5;}
 
 opcode_t *
 Parrot_index_i_sc_s_i(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (CONST(2).u.string && SREG(3)) ? Parrot_str_find_index(interp, CONST(2).u.string, SREG(3), IREG(4)) : -1;
+    IREG(1) = (CONST(2).u.string && SREG(3)) ? STRING_index(interp, CONST(2).u.string, SREG(3), IREG(4)) : -1;
 
 return (opcode_t *)cur_opcode + 5;}
 
 opcode_t *
 Parrot_index_i_s_sc_i(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (SREG(2) && CONST(3).u.string) ? Parrot_str_find_index(interp, SREG(2), CONST(3).u.string, IREG(4)) : -1;
+    IREG(1) = (SREG(2) && CONST(3).u.string) ? STRING_index(interp, SREG(2), CONST(3).u.string, IREG(4)) : -1;
 
 return (opcode_t *)cur_opcode + 5;}
 
 opcode_t *
 Parrot_index_i_sc_sc_i(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (CONST(2).u.string && CONST(3).u.string) ? Parrot_str_find_index(interp, CONST(2).u.string, CONST(3).u.string, IREG(4)) : -1;
+    IREG(1) = (CONST(2).u.string && CONST(3).u.string) ? STRING_index(interp, CONST(2).u.string, CONST(3).u.string, IREG(4)) : -1;
 
 return (opcode_t *)cur_opcode + 5;}
 
 opcode_t *
 Parrot_index_i_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (SREG(2) && SREG(3)) ? Parrot_str_find_index(interp, SREG(2), SREG(3), cur_opcode[4]) : -1;
+    IREG(1) = (SREG(2) && SREG(3)) ? STRING_index(interp, SREG(2), SREG(3), cur_opcode[4]) : -1;
 
 return (opcode_t *)cur_opcode + 5;}
 
 opcode_t *
 Parrot_index_i_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (CONST(2).u.string && SREG(3)) ? Parrot_str_find_index(interp, CONST(2).u.string, SREG(3), cur_opcode[4]) : -1;
+    IREG(1) = (CONST(2).u.string && SREG(3)) ? STRING_index(interp, CONST(2).u.string, SREG(3), cur_opcode[4]) : -1;
 
 return (opcode_t *)cur_opcode + 5;}
 
 opcode_t *
 Parrot_index_i_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (SREG(2) && CONST(3).u.string) ? Parrot_str_find_index(interp, SREG(2), CONST(3).u.string, cur_opcode[4]) : -1;
+    IREG(1) = (SREG(2) && CONST(3).u.string) ? STRING_index(interp, SREG(2), CONST(3).u.string, cur_opcode[4]) : -1;
 
 return (opcode_t *)cur_opcode + 5;}
 
 opcode_t *
 Parrot_index_i_sc_sc_ic(opcode_t *cur_opcode, PARROT_INTERP)  {
     const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
-    IREG(1) = (CONST(2).u.string && CONST(3).u.string) ? Parrot_str_find_index(interp, CONST(2).u.string, CONST(3).u.string, cur_opcode[4]) : -1;
+    IREG(1) = (CONST(2).u.string && CONST(3).u.string) ? STRING_index(interp, CONST(2).u.string, CONST(3).u.string, cur_opcode[4]) : -1;
 
 return (opcode_t *)cur_opcode + 5;}
 

Modified: branches/string_macros/src/ops/string.ops
==============================================================================
--- branches/string_macros/src/ops/string.ops	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/ops/string.ops	Wed Sep 22 01:21:16 2010	(r49226)
@@ -284,11 +284,11 @@
 =cut
 
 inline op index(out INT, in STR, in STR) :base_core {
-    $1 = ($2 && $3) ? Parrot_str_find_index(interp, $2, $3, 0) : -1;
+    $1 = ($2 && $3) ? STRING_index(interp, $2, $3, 0) : -1;
 }
 
 inline op index(out INT, in STR, in STR, in INT) :base_core {
-    $1 = ($2 && $3) ? Parrot_str_find_index(interp, $2, $3, $4) : -1;
+    $1 = ($2 && $3) ? STRING_index(interp, $2, $3, $4) : -1;
 }
 
 

Modified: branches/string_macros/src/pmc.c
==============================================================================
--- branches/string_macros/src/pmc.c	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/pmc.c	Wed Sep 22 01:21:16 2010	(r49226)
@@ -996,7 +996,7 @@
 
     do {
         INTVAL len;
-        const INTVAL idx = Parrot_str_find_index(interp, what, role, (INTVAL)pos);
+        const INTVAL idx = STRING_index(interp, what, role, pos);
 
         if ((idx < 0) || (idx >= length))
             return 0;

Modified: branches/string_macros/src/pmc/codestring.pmc
==============================================================================
--- branches/string_macros/src/pmc/codestring.pmc	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/pmc/codestring.pmc	Wed Sep 22 01:21:16 2010	(r49226)
@@ -115,7 +115,7 @@
 
     while (pos >= 0) {
         pos += replen;
-        pos = Parrot_str_find_index(INTERP, fmt, percent, pos);
+        pos = STRING_index(INTERP, fmt, percent, pos);
         if (pos < 0)
             break;
 
@@ -277,14 +277,14 @@
 
     escaped_str = Parrot_str_concat(INTERP, quote, escaped_str);
     escaped_str = Parrot_str_concat(INTERP, escaped_str, quote);
-    x_pos       = Parrot_str_find_index(INTERP, escaped_str, x, 0);
+    x_pos       = STRING_index(INTERP, escaped_str, x, 0);
 
     if (x_pos != -1) {
         is_unicode = 1;
     }
     else {
         STRING * const u = CONST_STRING(INTERP, "\\u");
-        const INTVAL u_pos = Parrot_str_find_index(INTERP, escaped_str, u, 0);
+        const INTVAL u_pos = STRING_index(INTERP, escaped_str, u, 0);
         if (u_pos != -1)
             is_unicode = 1;
     }

Modified: branches/string_macros/src/pmc/string.pmc
==============================================================================
--- branches/string_macros/src/pmc/string.pmc	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/pmc/string.pmc	Wed Sep 22 01:21:16 2010	(r49226)
@@ -507,7 +507,7 @@
         STRING       * s       = VTABLE_get_string(INTERP, SELF);
         INTVAL         i       = 0;
 
-        while (-1 != (i = Parrot_str_find_index(INTERP, s, orig, i))) {
+        while (-1 != (i = STRING_index(INTERP, s, orig, i))) {
             s = Parrot_str_replace(INTERP, s, i, old_len, _new);
             i += new_len;
         }

Modified: branches/string_macros/src/pmc/stringbuilder.pmc
==============================================================================
--- branches/string_macros/src/pmc/stringbuilder.pmc	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/pmc/stringbuilder.pmc	Wed Sep 22 01:21:16 2010	(r49226)
@@ -360,7 +360,7 @@
          * for the string builder. */
         while (pos >= 0) {
             /* Find the next % */
-            percentPos = Parrot_str_find_index(INTERP, fmt, percent, pos);
+            percentPos = STRING_index(INTERP, fmt, percent, pos);
 
             if (percentPos < 0) {
                 if (pos == 0) {

Modified: branches/string_macros/src/pmc/sub.pmc
==============================================================================
--- branches/string_macros/src/pmc/sub.pmc	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/pmc/sub.pmc	Wed Sep 22 01:21:16 2010	(r49226)
@@ -1040,7 +1040,7 @@
                 EXCEPTION_INVALID_OPERATION,
                 "illegal register kind '%Ss'", reg);
 
-        kind = Parrot_str_find_index(INTERP, types, reg, 0);
+        kind = STRING_index(INTERP, types, reg, 0);
 
         if (kind == -1)
             Parrot_ex_throw_from_c_args(INTERP, NULL,

Modified: branches/string_macros/src/string/api.c
==============================================================================
--- branches/string_macros/src/string/api.c	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/string/api.c	Wed Sep 22 01:21:16 2010	(r49226)
@@ -790,7 +790,11 @@
 
 Returns the character position of the second Parrot string in the first at or
 after C<start>. The return value is a (0 based) offset in characters, not
-bytes. If second string is not found in the first string, returns -1.
+bytes. If the search string is not found in the first string or it is null or
+empty, returns -1. If C<start> is out of bounds, returns -1. Throws an
+exception if C<src> is null.
+
+Identical to the STRING_index macro.
 
 =cut
 
@@ -804,11 +808,11 @@
 {
     ASSERT_ARGS(Parrot_str_find_index)
 
-    if ((UINTVAL)start >= STRING_length(src)
-    ||  !STRING_length(search))
-        return -1;
+    if (src == NULL)
+        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
+            "Invalid operation on null string");
 
-    return STRING_index(interp, src, search, (UINTVAL)start);
+    return STRING_index(interp, src, search, start);
 }
 
 

Modified: branches/string_macros/src/string/encoding/shared.c
==============================================================================
--- branches/string_macros/src/string/encoding/shared.c	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/string/encoding/shared.c	Wed Sep 22 01:21:16 2010	(r49226)
@@ -148,7 +148,7 @@
 /*
 
 =item C<INTVAL encoding_index(PARROT_INTERP, const STRING *src, const STRING
-*search, UINTVAL offs)>
+*search, INTVAL offset)>
 
 Searches for the first instance of STRING C<search> in STRING C<src>.
 returns the position where the substring is found if it is indeed found.
@@ -161,14 +161,18 @@
 
 PARROT_WARN_UNUSED_RESULT
 INTVAL
-encoding_index(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search),
-    UINTVAL offs)
+encoding_index(PARROT_INTERP, ARGIN(const STRING *src),
+        ARGIN(const STRING *search), INTVAL offset)
 {
     ASSERT_ARGS(encoding_index)
     String_iter start, end;
 
+    if ((UINTVAL)offset >= STRING_length(src)
+    ||  !STRING_length(search))
+        return -1;
+
     STRING_ITER_INIT(interp, &start);
-    STRING_iter_set_position(interp, src, &start, offs);
+    STRING_iter_set_position(interp, src, &start, offset);
 
     return Parrot_str_iter_index(interp, src, &start, &end, search);
 }
@@ -177,7 +181,7 @@
 /*
 
 =item C<INTVAL encoding_rindex(PARROT_INTERP, const STRING *src, const STRING
-*search_string, UINTVAL offset)>
+*search_string, INTVAL offset)>
 
 Finds the last index of substring C<search_string> in STRING C<src>,
 starting from C<offset>. Not implemented.
@@ -189,7 +193,7 @@
 PARROT_WARN_UNUSED_RESULT
 INTVAL
 encoding_rindex(PARROT_INTERP, SHIM(const STRING *src),
-        SHIM(const STRING *search_string), SHIM(UINTVAL offset))
+        SHIM(const STRING *search_string), SHIM(INTVAL offset))
 {
     ASSERT_ARGS(encoding_rindex)
     /* TODO: https://trac.parrot.org/parrot/wiki/StringsTasklist Implement this. */
@@ -724,7 +728,7 @@
 /*
 
 =item C<INTVAL fixed8_index(PARROT_INTERP, const STRING *src, const STRING
-*search_string, UINTVAL offset)>
+*search, INTVAL offset)>
 
 Searches for the first instance of STRING C<search> in STRING C<src>.
 returns the position where the substring is found if it is indeed found.
@@ -737,26 +741,23 @@
 PARROT_WARN_UNUSED_RESULT
 INTVAL
 fixed8_index(PARROT_INTERP, ARGIN(const STRING *src),
-        ARGIN(const STRING *search_string), UINTVAL offset)
+        ARGIN(const STRING *search), INTVAL offset)
 {
     ASSERT_ARGS(fixed8_index)
     INTVAL retval;
 
-    if (STRING_max_bytes_per_codepoint(search_string) != 1) {
-        return encoding_index(interp, src, search_string, offset);
-    }
+    if ((UINTVAL)offset >= STRING_length(src)
+    ||  !STRING_length(search))
+        return -1;
 
-    PARROT_ASSERT(STRING_max_bytes_per_codepoint(src) == 1);
-    retval = Parrot_byte_index(interp, src,
-            search_string, offset);
-    return retval;
+    return Parrot_byte_index(interp, src, search, offset);
 }
 
 
 /*
 
 =item C<INTVAL fixed8_rindex(PARROT_INTERP, const STRING *src, const STRING
-*search_string, UINTVAL offset)>
+*search_string, INTVAL offset)>
 
 Searches for the last instance of STRING C<search_string> in STRING
 C<src>. Starts searching at C<offset>.
@@ -768,7 +769,7 @@
 PARROT_WARN_UNUSED_RESULT
 INTVAL
 fixed8_rindex(PARROT_INTERP, ARGIN(const STRING *src),
-        ARGIN(const STRING *search_string), UINTVAL offset)
+        ARGIN(const STRING *search_string), INTVAL offset)
 {
     ASSERT_ARGS(fixed8_rindex)
     INTVAL retval;

Modified: branches/string_macros/src/string/encoding/shared.h
==============================================================================
--- branches/string_macros/src/string/encoding/shared.h	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/src/string/encoding/shared.h	Wed Sep 22 01:21:16 2010	(r49226)
@@ -74,7 +74,7 @@
 INTVAL encoding_index(PARROT_INTERP,
     ARGIN(const STRING *src),
     ARGIN(const STRING *search),
-    UINTVAL offs)
+    INTVAL offset)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
@@ -97,7 +97,7 @@
 INTVAL encoding_rindex(PARROT_INTERP,
     SHIM(const STRING *src),
     SHIM(const STRING *search_string),
-    NULLOK(UINTVAL offset))
+    NULLOK(INTVAL offset))
         __attribute__nonnull__(1);
 
 UINTVAL encoding_scan(PARROT_INTERP, ARGIN(const STRING *src))
@@ -140,8 +140,8 @@
 PARROT_WARN_UNUSED_RESULT
 INTVAL fixed8_index(PARROT_INTERP,
     ARGIN(const STRING *src),
-    ARGIN(const STRING *search_string),
-    UINTVAL offset)
+    ARGIN(const STRING *search),
+    INTVAL offset)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
@@ -197,7 +197,7 @@
 INTVAL fixed8_rindex(PARROT_INTERP,
     ARGIN(const STRING *src),
     ARGIN(const STRING *search_string),
-    UINTVAL offset)
+    INTVAL offset)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
@@ -312,7 +312,7 @@
 #define ASSERT_ARGS_fixed8_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src) \
-    , PARROT_ASSERT_ARG(search_string))
+    , PARROT_ASSERT_ARG(search))
 #define ASSERT_ARGS_fixed8_iter_get __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(str) \

Modified: branches/string_macros/t/op/string.t
==============================================================================
--- branches/string_macros/t/op/string.t	Wed Sep 22 01:20:33 2010	(r49225)
+++ branches/string_macros/t/op/string.t	Wed Sep 22 01:21:16 2010	(r49226)
@@ -957,10 +957,19 @@
     index $I1, $S0, $S1
     is( $I1, "-1", 'index, null strings' )
 
+    .local pmc eh
+    eh = new ['ExceptionHandler']
+    eh.'handle_types'(.EXCEPTION_UNEXPECTED_NULL)
+    set_addr eh, handler
+    push_eh eh
+    $I1 = 1
     null $S0
     null $S1
-    index $I1, $S0, $S1
-    is( $I1, "-1", 'index, null strings' )
+    index $I0, $S0, $S1
+    $I1 = 0
+  handler:
+    pop_eh
+    is( $I1, "1", "index with null string throws" )
 .end
 
 .sub index_embedded_nulls


More information about the parrot-commits mailing list