Show
Ignore:
Timestamp:
07/27/08 17:44:55 (6 months ago)
Author:
fglock
Message:

[v6.pm] fixed 'if'

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • perl5/Pugs-Compiler-Perl6/lib/Pugs/Emitter/Perl6/Perl5.pm

    r21572 r21573  
    10431043 
    10441044    if ( # XXX: obsoleted, fix unless to use new structure 
    1045          $n->{statement} eq 'unless' ) { 
     1045         $n->{statement} eq 'unless' )  
     1046    { 
    10461047        return  " " . $n->{statement} . 
    10471048                emit_parenthesis( $n->{exp1} ) . 
     
    10531054                emit_parenthesis( $n->{exp1} ) . 
    10541055                emit_block( $n->{exp2} ) . "\n"; 
    1055         for (@{$n->{exp3} || []}) { 
    1056             if (ref($_) eq 'ARRAY') { 
    1057                 $ret .= 'elsif '.emit_parenthesis( $_->[0] ) . 
    1058                     emit_block( $_->[1] ) . "\n"; 
    1059             } 
    1060             else { 
    1061                 $ret .= 'else '. emit_block( $_ ) . "\n"; 
    1062             } 
    1063         } 
    1064         return $ret; 
     1056        if ( $n->{elsif} ) { 
     1057            my ($exps, $blocks) = @{$n->{elsif}}; 
     1058            for (0 .. $#$exps) { 
     1059                $ret .= 'elsif '.emit_parenthesis( ${$exps}[$_]->() ) . 
     1060                            emit_block( ${$blocks}[$_]->() ) . "\n"; 
     1061            } 
     1062        } 
     1063        if ( $n->{else} ) { 
     1064            $ret .= 'else '. emit_block( $n->{else} ) . "\n"; 
     1065        } 
     1066        return $ret; 
    10651067    } 
    10661068