- Timestamp:
- 07/25/08 23:52:06 (4 months ago)
- Location:
- perl5/Pugs-Compiler-Perl6/lib/Pugs
- Files:
-
- 2 modified
-
Emitter/Perl6/Perl5.pm (modified) (4 diffs)
-
Runtime/Perl6.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
perl5/Pugs-Compiler-Perl6/lib/Pugs/Emitter/Perl6/Perl5.pm
r21543 r21546 408 408 } 409 409 410 sub _emit_array_index { 411 my $n = shift; 412 if ( ref($n) eq 'HASH' 413 && exists $n->{op1} 414 && $n->{op1} eq '*' 415 && $n->{fixity} eq 'prefix' 416 ) 417 { 418 return _emit( $n->{exp1} ); 419 } 420 return _emit( $n ); 421 } 422 410 423 sub _emit_parameter_signature { 411 424 my $n = $_[0] or return ''; … … 653 666 ) 654 667 { 655 if ( $n->{sub}{bareword} eq 'push' 656 && $n->{op1} eq 'call' 657 && ( _is_paren_containing($n->{param}, \&_is_empty_exp) 658 || _is_paren_containing($n->{param}, \&_is_exp_containing, \&_is_empty_braces ) 659 ) 660 ) 661 { 662 return _not_implemented( "push without parameters", "call" ); 668 if ( $n->{sub}{bareword} eq 'push' && $n->{op1} eq 'call' ) { 669 if ( _is_paren_containing($n->{param}, \&_is_empty_exp) ) { 670 return _not_implemented( "push without parameters", "call" ); 671 } 672 if ( _is_paren_containing($n->{param}, \&_is_exp_containing, \&_is_empty_braces ) ) { 673 return " # push( [] ) ??? \n"; # See: push.t 674 } 663 675 } 664 676 … … 771 783 } 772 784 773 if ($subname eq 'substr' || $subname eq 'split' || $subname eq 'die' || $subname eq 'return' || $subname eq 'push' || $subname eq ' shift' || $subname eq 'join' || $subname eq 'index' || $subname eq 'undef' || $subname eq 'rand' || $subname eq 'int' || $subname eq 'splice' || $subname eq 'keys' || $subname eq 'values' || $subname eq 'sort' || $subname eq 'chomp' || $subname eq 'lc' || $subname eq 'abs' ) {785 if ($subname eq 'substr' || $subname eq 'split' || $subname eq 'die' || $subname eq 'return' || $subname eq 'push' || $subname eq 'pop' || $subname eq 'shift' || $subname eq 'join' || $subname eq 'index' || $subname eq 'undef' || $subname eq 'rand' || $subname eq 'int' || $subname eq 'splice' || $subname eq 'keys' || $subname eq 'values' || $subname eq 'sort' || $subname eq 'chomp' || $subname eq 'lc' || $subname eq 'abs' ) { 774 786 return $subname . emit_parenthesis( $n->{param} ); 775 787 } … … 1644 1656 ) 1645 1657 ; 1646 return $name . '[' . _emit ( $n->{exp2} ) . ']';1647 } 1648 1649 return _emit( $n->{exp1} ) . '->[' . _emit ( $n->{exp2} ) . ']';1658 return $name . '[' . _emit_array_index( $n->{exp2} ) . ']'; 1659 } 1660 1661 return _emit( $n->{exp1} ) . '->[' . _emit_array_index( $n->{exp2} ) . ']'; 1650 1662 } 1651 1663 -
perl5/Pugs-Compiler-Perl6/lib/Pugs/Runtime/Perl6.pm
r21419 r21546 246 246 use Scalar::Util qw(looks_like_number); 247 247 248 sub elems { 249 return scalar @{$_[0]} if ref($_[0]) eq 'ARRAY'; 250 return 1; 251 } 252 248 253 sub perl { 249 254 local $Data::Dumper::Terse = 1;
