diff --git a/Grammar/Actions.nqp b/Grammar/Actions.nqp index 2823553..99d5ffe 100644 --- a/Grammar/Actions.nqp +++ b/Grammar/Actions.nqp @@ -1,5 +1,6 @@ # $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; @@ -233,9 +234,13 @@ method lambda_form($/) { my $expr := $( $ ); ## 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(:inline('%r = newclosure %0'),$past); + make $closure; } method funcdef($/) {