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

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

From:
tene
Date:
December 10, 2008 00:14
Subject:
[svn:parrot] r33749 - trunk/compilers/pct/src/PAST
Message ID:
20081210081440.0EB8BCB9AF@x12.develooper.com
Author: tene
Date: Wed Dec 10 00:14:39 2008
New Revision: 33749

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

Log:
[pct]: Support exception handlers on PAST::Blocks.

Modified: trunk/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Compiler.pir	(original)
+++ trunk/compilers/pct/src/PAST/Compiler.pir	Wed Dec 10 00:14:39 2008
@@ -566,7 +566,7 @@
     ops = self.'post_children'(node, 'signature'=>$S0)
     $P0 = ops[-1]
     ops.'result'($P0)
-    .local pmc eh, iter
+    .local pmc eh
     eh = node.'handlers'()
     unless eh, no_eh
     ops = self.'wrap_handlers'(ops,eh,'rtype'=>rtype)
@@ -825,12 +825,22 @@
     $S0 = repeat 'v', $I0
     concat $S0, '*'
     ##  convert children to post
-    .local pmc ops
+    .local pmc ops, retval
     ops = self.'post_children'(node, 'signature'=>$S0)
-    bpost.'push'(ops)
+    ##  wrap the child with appropriate exception handlers, if any
+    .local pmc eh
+    eh = node.'handlers'()
+    unless eh, no_eh
+    $S0 = options['rtype']
+    retval = ops[-1]
+    ops = self.'wrap_handlers'(ops,eh,'rtype'=>$S0)
+    goto had_eh
+  no_eh:
     ##  result of last child is return from block
-    $P0 = ops[-1]
-    bpost.'push_pirop'('return', $P0)
+    retval = ops[-1]
+  had_eh:
+    bpost.'push'(ops)
+    bpost.'push_pirop'('return', retval)
 
     unless ctrlpast goto sub_done
     bpost.'push'(ctrllabel)

Modified: trunk/compilers/pct/src/PAST/Node.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Node.pir	(original)
+++ trunk/compilers/pct/src/PAST/Node.pir	Wed Dec 10 00:14:39 2008
@@ -105,7 +105,7 @@
 .sub 'handlers' :method
     .param pmc value           :optional
     .param int has_value       :opt_flag
-    .tailcall self.'attr'('handle_types', value, has_value)
+    .tailcall self.'attr'('handlers', value, has_value)
 .end
 
 



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