Author: bernhard
Date: Fri Nov 28 08:28:50 2008
New Revision: 33314
Modified:
trunk/languages/pipp/src/common/php_var.pir
trunk/languages/pipp/t/php/null.t
Log:
[Pipp] handle NULL in var_dump()
Modified: trunk/languages/pipp/src/common/php_var.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_var.pir (original)
+++ trunk/languages/pipp/src/common/php_var.pir Fri Nov 28 08:28:50 2008
@@ -102,10 +102,8 @@
.return()
-L1:
-
+ L1:
unless type_of_pmc == 'array' goto L2
-
.local int num_elements
num_elements = elements a
string_len = elements a
@@ -144,20 +142,16 @@
say '}'
.return()
-L2:
-
+ L2:
unless type_of_pmc == 'integer' goto L3
-
print 'int('
print a
say ')'
.return()
-L3:
-
+ L3:
unless type_of_pmc == 'boolean' goto L4
-
print 'bool('
if a goto a_is_true
print 'false'
@@ -168,8 +162,14 @@
say ')'
.return()
-L4:
-
+ L4:
+ unless type_of_pmc == 'NULL' goto L5
+ say 'NULL'
+ .return()
+
+ L5:
+ # this should never happen
+ say type_of_pmc
_dumper(a)
.return()
Modified: trunk/languages/pipp/t/php/null.t
==============================================================================
--- trunk/languages/pipp/t/php/null.t (original)
+++ trunk/languages/pipp/t/php/null.t Fri Nov 28 08:28:50 2008
@@ -22,7 +22,7 @@
use FindBin;
use lib "$FindBin::Bin/../../../../lib", "$FindBin::Bin/../../lib";
-use Parrot::Test tests => 2;
+use Parrot::Test tests => 3;
language_output_is( 'Pipp', <<'CODE', <<'OUT', 'Stringification of an
undefined var' );
@@ -52,6 +52,15 @@
NULL was redefined
OUT
+language_output_is( 'Pipp', <<'CODE', <<'OUT', 'var_dump(NULL)' );
+<?php
+var_dump(NULL);
+var_dump($a);
+CODE
+NULL
+NULL
+OUT
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4