Commits

Anonymous committed b2e5d78

Lambda expressions do not form closures properly unless 'newclosure' pir opcode is used.
Closes Launchpad Bug #407838

Comments (0)

Files changed (2)

+2009-08-01  Bradley M. Kuhn  <bkuhn@ebb.org>
+
+	* Actions.nqp (lambda_form): generate newclosure 'pirop' for
+	block.

Grammar/Actions.nqp

 # $Id: Actions.pm 36833 2009-02-17 20:09:26Z allison $
 # Copyright (C) 2007, Parrot Foundation.
+# Copyright (C) 2009, Bradley M. Kuhn.
 
 class Pynie::Grammar::Actions;
 
     ## add a return statement to this block
     $past.push( PAST::Op.new( $expr, :pasttype('return'), :node($/) ) );
     $past.control('return_pir');
-    make $past;
+    # We need to create a closure each time the lambda() is evaluated
+    my $closure := PAST::Op.new(:pirop('newclosure'),$past);
+    make $closure;
+
 }
 
 method funcdef($/) {