From e816e6bbbfe03b0ab15344155250ced004a7f924 Mon Sep 17 00:00:00 2001 From: Drahflow Date: Mon, 7 Jan 2013 15:07:33 +0100 Subject: Correctly handle unquoted scope capture --- interpreter/ElymasGlobal.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'interpreter') diff --git a/interpreter/ElymasGlobal.pm b/interpreter/ElymasGlobal.pm index 9cb0337..fddf483 100644 --- a/interpreter/ElymasGlobal.pm +++ b/interpreter/ElymasGlobal.pm @@ -37,7 +37,8 @@ our $global = { push @$data, ['{', 'tok', '{']; }, ['func', '{'], 'quote'], '}' => [sub { - my ($data, $scope) = @_; + my ($data, $refScope) = @_; + my $scope = $$refScope; --$quoted; @@ -61,13 +62,14 @@ our $global = { } else { push @$data, [sub { my ($data) = @_; - my $lscope = \{ ' parent' => $$scope }; + my $lscope = \{ ' parent' => $scope }; interpretCode(\@code, $data, $lscope); }, ['func', 'Dumper(\@code)']]; } }, ['func', '}'], 'quote'], "}'" => [sub { - my ($data, $scope) = @_; + my ($data, $refScope) = @_; + my $scope = $$refScope; --$quoted; @@ -90,7 +92,7 @@ our $global = { } else { push @$data, [sub { my ($data) = @_; - interpretCode(\@code, $data, $scope); + interpretCode(\@code, $data, \$scope); }, ['func', 'Dumper(\@code)']]; } }, ['func', '}'], 'quote'], -- cgit v1.2.3