On Wed, 9 Oct 2002, Tom Hughes wrote:

> In message <[EMAIL PROTECTED]>
>           Simon Glover <[EMAIL PROTECTED]> wrote:
>
> >  I've just had a quick look at hash.h (which I should have done in the
> >  first place) and you're quite right. Second attempt at a correct patch
> >  below.
> >
> >  All tests still pass, but this isn't much comfort, as the fact that the
> >  preceding patch 'worked' suggests that nothing's actually testing this
> >  line of code. I'll see if I can do something to remedy this tomorrow,
> >  unless somebody beats me to it.
>
> That looks better, although you can actually get rid of the cast
> once you do that as pmc_val has the right type.
>

 OK, third time lucky... the patch below removes the cast as Tom suggests,
 and also adds a test case to perlhash.t that exercises the code.

 Simon

--- classes/perlhash.pmc.old    Wed Oct  9 15:59:29 2002
+++ classes/perlhash.pmc        Thu Oct 10 11:42:26 2002
@@ -189,7 +189,7 @@ pmclass PerlHash {
            if (!nextkey)
             return entry->val.pmc_val;
            return entry->val.pmc_val->vtable->get_pmc_keyed(INTERP,
-                   entry, nextkey);
+                   entry->val.pmc_val, nextkey);

         }
         internal_exception(OUT_OF_BOUNDS,


--- t/pmc/perlhash.t.old        Thu Oct 10 11:43:29 2002
+++ t/pmc/perlhash.t    Thu Oct 10 11:46:14 2002
@@ -1,6 +1,6 @@
 #! perl

-use Parrot::Test tests => 16;
+use Parrot::Test tests => 17;
 use Test::More;

 output_is(<<'CODE', <<OUTPUT, "simple set / get");
@@ -537,4 +537,19 @@ ok 5
 ok 6
 OUTPUT

+output_is(<<'CODE', <<OUTPUT, "Getting PMCs from compound keys");
+    new P0, .PerlHash
+    new P1, .PerlHash
+    new P2, .PerlInt
+    set P2, 12
+    set P1["b"], P2
+    set P0["a"], P1
+    set P3, P0["a";"b"]
+    print P3
+    print "\n"
+    end
+CODE
+12
+OUTPUT
+
 1;

Reply via email to