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

[svn:parrot] r34308 - trunk/compilers/pct/src/PAST

From:
pmichaud
Date:
December 23, 2008 17:30
Subject:
[svn:parrot] r34308 - trunk/compilers/pct/src/PAST
Message ID:
20081224013051.9EC48CBA12@x12.develooper.com
Author: pmichaud
Date: Tue Dec 23 17:30:50 2008
New Revision: 34308

Modified:
   trunk/compilers/pct/src/PAST/Compiler.pir

Log:
[pct]:  Add 'next' component to PAST::Op  while/until/repeat_*  nodes


Modified: trunk/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Compiler.pir	(original)
+++ trunk/compilers/pct/src/PAST/Compiler.pir	Tue Dec 23 17:30:50 2008
@@ -1266,13 +1266,14 @@
     $S0 = concat loopname, '_handler'
     handlabel = $P0.'new'('result'=>$S0)
 
-    .local pmc testpost, prepost, bodypost
+    .local pmc testpost, prepost, bodypost, nextpost
     .local string testop
     .local int bodyfirst
     testop = options['testop']
     testpost = options['test']
     prepost  = options['pre']
     bodypost = options['body']
+    nextpost = options['next']
     bodyfirst = options['bodyfirst']
 
     if testop goto have_testop
@@ -1306,6 +1307,9 @@
     ops.'push'(bodypost)
   body_done:
     ops.'push'(nextlabel)
+    if null nextpost goto next_done
+    ops.'push'(nextpost)
+  next_done:
     ops.'push_pirop'('goto', testlabel)
     ops.'push'(handlabel)
     ops.'push_pirop'('.local pmc exception')
@@ -1335,11 +1339,12 @@
 .sub 'while' :method :multi(_, ['PAST';'Op'])
     .param pmc node
     .param pmc options         :slurpy :named
-    .local pmc exprpast, bodypast
+    .local pmc exprpast, bodypast, nextpast
     exprpast = node[0]
     bodypast = node[1]
+    nextpast = node[2]
 
-    .local pmc exprpost, bodypost   
+    .local pmc exprpost, bodypost, nextpost
     exprpost = self.'as_post'(exprpast, 'rtype'=>'r') 
 
     .local pmc arglist
@@ -1350,13 +1355,18 @@
   have_arglist:
     bodypost = self.'as_post'(bodypast, 'rtype'=>'v', 'arglist'=>arglist)
 
+    null nextpost
+    if null nextpast goto have_nextpost
+    nextpost = self.'as_post'(nextpast, 'rtype'=>'v')
+  have_nextpost:
+
     .local string testop
     testop = options['testop']
     .local int bodyfirst
     bodyfirst = options['bodyfirst']
 
     .local pmc ops
-    ops = self.'loop_gen'('testop'=>testop, 'test'=>exprpost, 'body'=>bodypost, 'bodyfirst'=>bodyfirst)
+    ops = self.'loop_gen'('testop'=>testop, 'test'=>exprpost, 'body'=>bodypost, 'bodyfirst'=>bodyfirst, 'next'=>nextpost)
     ops.'result'(exprpost)
     ops.'node'(node)
     .return (ops)



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