Permalink
Browse files

[Yapsi] fix binding var detection

In generating the SIC for a binding statement, detecting whether the rhs
was a variable used to be tricky business. With FUTURE it's dead simple.
This accidentally makes nested subroutine declarations work.
  • Loading branch information...
1 parent ed8d0a6 commit 4264822b84f27cc63486acf706a7d5176f2856ad @masak committed Mar 7, 2011
Showing with 3 additions and 6 deletions.
  1. +3 −6 lib/Yapsi.pm
View
@@ -465,14 +465,11 @@ class Yapsi::Compiler {
my $expression-register = $register;
process $bind.children[0]; # FUTURE::Var
$register = $expression-register;
- # XXX: This latter test is for catching bindings to
- # blocks. The test is not very robust, but it
- # works for the time being.
- if $rightloc eq '<constant>' || !defined $rightloc {
- push @blocksic, "bind $locator, $register";
+ if $bind.children[1] ~~ FUTURE::Var {
+ push @blocksic, "bind $locator, $rightloc";
}
else {
- push @blocksic, "bind $locator, $rightloc";
+ push @blocksic, "bind $locator, $register";
}
}

0 comments on commit 4264822

Please sign in to comment.