Author: bernhard
Date: Tue Nov 25 11:40:52 2008
New Revision: 33197

Modified:
   trunk/languages/pipp/docs/overview.pod
   trunk/languages/pipp/src/common/php_builtin.pir
   trunk/languages/pipp/src/pct/actions.pm
   trunk/languages/pipp/t/php/oo.t

Log:
[Pipp]
Fix support for class constants.
Do not use the PHP function 'defined' for definedness of a PIR register


Modified: trunk/languages/pipp/docs/overview.pod
==============================================================================
--- trunk/languages/pipp/docs/overview.pod      (original)
+++ trunk/languages/pipp/docs/overview.pod      Tue Nov 25 11:40:52 2008
@@ -15,7 +15,18 @@
 Support well behaving PHP extensions.
 
 A secondary goal is to provide a side by side comparison
-of different parsing and tree transformation techniques. 
+of different parsing and tree transformation techniques.
+
+=head1 Divergences of Pipp
+
+=over 4
+
+=item builtin function pipp_defined().
+
+=cut
+
+=head1 Variants
+
 Therefore there are currently three variants of Pipp:
 
 =over

Modified: trunk/languages/pipp/src/common/php_builtin.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_builtin.pir     (original)
+++ trunk/languages/pipp/src/common/php_builtin.pir     Tue Nov 25 11:40:52 2008
@@ -145,6 +145,18 @@
     .RETURN_BOOL($I0)
 .end
 
+=item C<bool pipp_defined(string constant_name)>
+
+Check whether a Parrot register is defined.
+
+=cut
+
+.sub 'pipp_defined'
+    .param pmc x
+    $I0 = defined x
+    .return ($I0)
+.end
+
 =item C<array each(array arr)>
 
 Return the currently pointed key..value pair in the passed array, and advance 
the pointer to the next element

Modified: trunk/languages/pipp/src/pct/actions.pm
==============================================================================
--- trunk/languages/pipp/src/pct/actions.pm     (original)
+++ trunk/languages/pipp/src/pct/actions.pm     Tue Nov 25 11:40:52 2008
@@ -29,7 +29,7 @@
     # subrules may have added stuff to $?INIT
     # execute it first
     our $?INIT;
-    if defined( $?INIT ) {
+    if pipp_defined( $?INIT ) {
         $?INIT.blocktype('declaration');
         $?INIT.pirflags(':init :load');
         $past.unshift( $?INIT );
@@ -192,7 +192,7 @@
 # class constants could probably also be set in a class init block
 method class_constant_definition($/) {
     our $?INIT;
-    unless defined( $?INIT ) {
+    unless pipp_defined( $?INIT ) {
         $?INIT := PAST::Block.new();
     }
     $?INIT.push( 

Modified: trunk/languages/pipp/t/php/oo.t
==============================================================================
--- trunk/languages/pipp/t/php/oo.t     (original)
+++ trunk/languages/pipp/t/php/oo.t     Tue Nov 25 11:40:52 2008
@@ -35,7 +35,7 @@
 After class definition.
 OUT
 
-language_output_is( 'Pipp', <<'CODE', <<'OUT', 'class constant', todo => 'not 
implemented yet' );
+language_output_is( 'Pipp', <<'CODE', <<'OUT', 'class constant' );
 <?php
 
 class Foo {

Reply via email to