Hi,

the attached patch fixes null PMC dumping and adds a test for it.

jens
Index: t/pmc/dumper.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/dumper.t,v
retrieving revision 1.8
diff -u -r1.8 dumper.t
--- t/pmc/dumper.t	15 Mar 2004 08:03:25 -0000	1.8
+++ t/pmc/dumper.t	16 Mar 2004 00:20:36 -0000
@@ -18,7 +18,7 @@
 
 use strict;
 
-use Parrot::Test tests => 12;
+use Parrot::Test tests => 13;
 
 # no. 1
 output_is(<<'CODE', <<'OUT', "dumping array of sorted numbers");
@@ -574,5 +574,43 @@
         this is
         _TestClass::__dump
     }
+]
+OUT
+
+# no. 13
+output_is(<<'CODE', <<'OUT', "dumping 'null'");
+##PIR##
+.sub _main
+    .local pmc array
+    .local pmc temp
+    
+    new array, .PerlArray
+
+    push array, 0
+
+    push array, "0"
+
+    null temp
+    push array, temp
+
+    new temp, .PerlInt
+    set temp, 0
+    push array, temp
+
+    new temp, .PerlString
+    set temp, "0"
+    push array, temp
+
+    _dumper( "array", array )
+    end
+.end
+.include "library/dumper.imc"
+CODE
+"array" => PerlArray (size:5) [
+    0,
+    "0",
+    null,
+    0,
+    "0"
 ]
 OUT
Index: library/Data/Dumper/Base.imc
===================================================================
RCS file: /cvs/public/parrot/library/Data/Dumper/Base.imc,v
retrieving revision 1.1
diff -u -r1.1 Base.imc
--- library/Data/Dumper/Base.imc	14 Mar 2004 17:52:30 -0000	1.1
+++ library/Data/Dumper/Base.imc	16 Mar 2004 00:20:36 -0000
@@ -207,21 +207,18 @@
 NOT_IN_CACHE:
     # is dump null?
     # lookup the type id otherwise
-    set type, 0
-    isnull dump, IS_NULL
-    typeof type, dump
-IS_NULL:
+    set func, "pmcNull"
+    isnull dump, DUMP
 
     # does a helper method exists?
     typeof temp, dump
     set func, "pmc"
     concat func, temp
     can ret, self, func
-    if ret goto CAN
-    set func, "pmcDefault"
-CAN:
-
+    if ret goto DUMP
     # no, dump as a unknown PMC
+    set func, "pmcDefault"
+DUMP:
     ret = self.func( name, dump )
     unless ret goto END
 

Reply via email to