[Jifty-commit] r3513 - jifty/branches/trimclient/lib/Jifty/View/Declare

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Jun 17 16:47:18 EDT 2007


Author: clkao
Date: Sun Jun 17 16:47:17 2007
New Revision: 3513

Modified:
   jifty/branches/trimclient/lib/Jifty/View/Declare/Compile.pm

Log:
more enteriter cases.

Modified: jifty/branches/trimclient/lib/Jifty/View/Declare/Compile.pm
==============================================================================
--- jifty/branches/trimclient/lib/Jifty/View/Declare/Compile.pm	(original)
+++ jifty/branches/trimclient/lib/Jifty/View/Declare/Compile.pm	Sun Jun 17 16:47:17 2007
@@ -38,10 +38,8 @@
 
 use constant method_invocation => '.';
 
-sub is_state {
-    goto \&B::Deparse::is_state;
-}
-*null = B::Deparse::null;
+sub is_state { goto \&B::Deparse::is_state }
+sub null { goto \&B::Deparse::null }
 
 sub padname {
     my $self = shift;
@@ -82,11 +80,27 @@
 	    $ary = $self->deparse($ary, 1);
 	}
 
-	if ($var->name ne "gv") {
+	if (null $var) {
+	    if ($enter->flags & OPf_SPECIAL) { # thread special var
+		$var = $self->pp_threadsv($enter, 1);
+	    } else { # regular my() variable
+		$var = $self->padname($enter->targ);
+	    }
+	} elsif ($var->name eq "rv2gv") {
+	    $var = $self->pp_rv2sv($var, 1);
+	    if ($enter->private & OPpOUR_INTRO) {
+		# our declarations don't have package names
+		$var =~ s/^(.).*::/$1/;
+		$var = "our $var";
+	    }
+	} elsif ($var->name eq "gv") {
+	    $var = $self->deparse($var, 1);
+	    $var = '$' . $var if $var eq '_';
+	}
+	else {
 	    return $self->SUPER::loop_common(@_);
 	}
 
-	$var = '$' . $self->deparse($var, 1);
 
 	my $body = $kid->first->first->sibling; # skip OP_AND and OP_ITER
 	# statement() foreach (@foo);
@@ -96,7 +110,7 @@
 	    return "$ary.each(function (\$_) {".$self->deparse($body, 2)."} )";
 	}
 	# XXX not handling cont block here yet
-	return "$ary.each(function (\$_) {".$self->deparse($body, 0)."} )";
+	return "$ary.each(function ($var) {".$self->deparse($body, 0)."} )";
     }
     return $self->SUPER::loop_common(@_);
 }


More information about the Jifty-commit mailing list