[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl6-internals
Subject:    Past-pm init() improvement
From:       François PERRAD <francois.perrad () gadz ! org>
Date:       2007-05-29 12:14:34
Message-ID: 5.1.0.14.2.20070529140715.039a52c8 () pop ! besancon ! parkeon ! com
[Download RAW message or body]

With the following patch, the method init of 'PAST::Node' returns the node.

It's allow the use of tail call, for example :
     .local pmc past
     past = new 'PAST::Val'
     past.'init'('node'=>node, 'vtype'=>'.LuaBoolean', 'name'=>1)
     .return (past)
becomes :
     .local pmc past
     past = new 'PAST::Val'
     .return past.'init'('node'=>node, 'vtype'=>'.LuaBoolean', 'name'=>1)

François
["Node.patch" (application/octet-stream)]

Index: compilers/past-pm/PAST/Node.pir
===================================================================
--- compilers/past-pm/PAST/Node.pir	(revision 18671)
+++ compilers/past-pm/PAST/Node.pir	(working copy)
@@ -64,6 +64,7 @@
 Initialize a PAST node with the given children and attributes.
 Adds each child to the node (using the C<push> method, below) and
 calls the appropriate accessor method for each attribute.
+And returns the node.
 
 =cut
 
@@ -92,7 +93,7 @@
     goto adverbs_loop
   adverbs_end:
   end:
-    .return ()
+    .return (self)
 .end
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic