Author: bernhard
Date: Fri Nov 28 09:55:08 2008
New Revision: 33316

Modified:
   trunk/languages/pipp/src/common/php_var.pir
   trunk/languages/pipp/src/pct/grammar.pg
   trunk/languages/pipp/t/php/functions.t

Log:
[Pipp] add TODO test for pass by reference


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 09:55:08 2008
@@ -166,7 +166,7 @@
     unless type_of_pmc == 'NULL' goto L5
         say 'NULL'
         .return()
-  
+
   L5:
     # this should never happen
     say type_of_pmc

Modified: trunk/languages/pipp/src/pct/grammar.pg
==============================================================================
--- trunk/languages/pipp/src/pct/grammar.pg     (original)
+++ trunk/languages/pipp/src/pct/grammar.pg     Fri Nov 28 09:55:08 2008
@@ -360,7 +360,7 @@
 }
 
 rule param_list {
-    '(' [ <VAR_NAME> [',' <VAR_NAME>]* ]? ')'
+    '(' [ '&'? <VAR_NAME> [',' '&'? <VAR_NAME>]* ]? ')'
     {*}
 }
 

Modified: trunk/languages/pipp/t/php/functions.t
==============================================================================
--- trunk/languages/pipp/t/php/functions.t      (original)
+++ trunk/languages/pipp/t/php/functions.t      Fri Nov 28 09:55:08 2008
@@ -15,18 +15,12 @@
 
 =cut
 
-# pragmata
 use strict;
 use warnings;
-
 use FindBin;
 use lib "$FindBin::Bin/../../../../lib", "$FindBin::Bin/../../lib";
 
-# core Perl modules
-use Test::More     tests => 5;
-
-# Parrot modules
-use Parrot::Test;
+use Parrot::Test tests => 7;
 
 language_output_is( 'Pipp', <<'CODE', <<'OUT', 'function with no args' );
 <?php
@@ -66,6 +60,48 @@
 count: 123456
 OUT
 
+language_output_is( 'Pipp', <<'CODE', <<'OUT', 'pass by value' );
+<?php
+
+function thrice( $a )  {
+  echo "$a times 3 is ";
+  $a = $a * 3;
+  echo "$a.\n";
+}
+
+$a = 22;
+echo "before: $a\n";
+thrice( $a );
+echo "after: $a\n";
+
+?>
+CODE
+before: 22
+22 times 3 is 66.
+after: 22
+OUT
+
+language_output_is( 'Pipp', <<'CODE', <<'OUT', 'pass by reference', todo => 
'not implemented yet' );
+<?php
+
+function thrice( &$a )  {
+  echo "$a times 3 is ";
+  $a = $a * 3;
+  echo "$a.\n";
+}
+
+$a = 22;
+echo "before: $a\n";
+thrice( $a );
+echo "after: $a\n";
+
+?>
+CODE
+before: 22
+22 times 3 is 66.
+after: 66
+OUT
+
 =for perl6
 
 sub echo_count( $count )  {

Reply via email to