develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34588 - in trunk: examples/pir languages/pipp/src/pct languages/pipp/t/php

From:
bernhard
Date:
December 29, 2008 11:28
Subject:
[svn:parrot] r34588 - in trunk: examples/pir languages/pipp/src/pct languages/pipp/t/php
Message ID:
20081229192755.CE126CB9FA@x12.develooper.com
Author: bernhard
Date: Mon Dec 29 11:27:55 2008
New Revision: 34588

Modified:
   trunk/examples/pir/quine_ord.pir
   trunk/languages/pipp/src/pct/actions.pm
   trunk/languages/pipp/t/php/oo.t

Log:
[codingstd] remove a trailing space.


Modified: trunk/examples/pir/quine_ord.pir
==============================================================================
--- trunk/examples/pir/quine_ord.pir	(original)
+++ trunk/examples/pir/quine_ord.pir	Mon Dec 29 11:27:55 2008
@@ -1434,7 +1434,7 @@
 push code_as_data, 44
 push code_as_data, 32
 push code_as_data, 39
-push code_as_data, 114 
+push code_as_data, 114
 push code_as_data, 39
 push code_as_data, 10
 push code_as_data, 32

Modified: trunk/languages/pipp/src/pct/actions.pm
==============================================================================
--- trunk/languages/pipp/src/pct/actions.pm	(original)
+++ trunk/languages/pipp/src/pct/actions.pm	Mon Dec 29 11:27:55 2008
@@ -409,12 +409,17 @@
 }
 
 method member($/) {
-    make PAST::Op.new(
-             :inline( "%r = self" )
-         );
+    make
+        PAST::Op.new(
+            :pasttype('callmethod'),
+            :name('member'),
+            PAST::Var.new(
+                :name('$this'),
+                :scope('lexical')
+            )
+        );
 }
 
-
 method while_statement($/) {
     my $past := $( $<conditional_expression> );
     $past.pasttype('while');
@@ -639,12 +644,42 @@
         }
 
         my $methods_block := PAST::Block.new( :blocktype('immediate') );
+
+        # declare the attributes
         for $<class_member_definition> {
             $methods_block.symbol( ~$_<VAR_NAME><ident>, :scope('attribute') );
+            $methods_block.push(
+                PAST::Var.new(
+                    :name(~$_<VAR_NAME><ident>),
+                    :scope('attribute'),
+                    :isdecl(1)
+                )
+            );
         }
+
+        # add the methods
         for $<class_method_definition> {
             $methods_block.push( $($_) );
         }
+
+        # add accessors for the attributes
+        for $<class_member_definition> {
+            $methods_block.push(
+                PAST::Block.new(
+                    :blocktype('declaration'),
+                    :name(~$_<VAR_NAME><ident>),
+                    :pirflags(':method'),
+                    :node( $/ ),
+                    PAST::Stmts.new(
+                        PAST::Var.new(
+                            :name(~$_<VAR_NAME><ident>),
+                            :scope('attribute')
+                        )
+                    )
+                )
+            );
+        }
+
         $block.push( $methods_block );
 
         make $block;

Modified: trunk/languages/pipp/t/php/oo.t
==============================================================================
--- trunk/languages/pipp/t/php/oo.t	(original)
+++ trunk/languages/pipp/t/php/oo.t	Mon Dec 29 11:27:55 2008
@@ -152,7 +152,7 @@
 }
 
 $foo = new Foo;
-$foo->echo_menber();
+$foo->echo_member();
 
 ?>
 CODE



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About