diff options
| author | Drahflow <drahflow@gmx.de> | 2013-01-07 15:07:33 +0100 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2013-01-07 15:07:33 +0100 |
| commit | e816e6bbbfe03b0ab15344155250ced004a7f924 (patch) | |
| tree | 74aff268dd0ec215b2a5ce2968e28437408c02f0 | |
| parent | 80a0a5eefedf123ae25966396283e35305c93440 (diff) | |
Correctly handle unquoted scope capture
| -rw-r--r-- | examples/working/array-list.ey | 19 | ||||
| -rw-r--r-- | interpreter/ElymasGlobal.pm | 10 |
2 files changed, 25 insertions, 4 deletions
diff --git a/examples/working/array-list.ey b/examples/working/array-list.ey new file mode 100644 index 0000000..de34ad9 --- /dev/null +++ b/examples/working/array-list.ey @@ -0,0 +1,19 @@ +< + [ 0 1 2 ] /list defv + + { + list [ -102 ] cat =list + } + + { + list dump + } +> -- /dumpAll deff /append deff + +"here" dump + +3 append +4 append +5 append + +dumpAll 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'], |
