Ignore:
Timestamp:
06/25/09 09:12:24 (3 years ago)
Author:
jquelin
Message:

detecting moose attributes in outline view

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Task/Outline/Perl.pm

    r5548 r5577  
    6868                if ref $_[0] eq 'PPI::Statement::Package' 
    6969                    or ref $_[0] eq 'PPI::Statement::Include' 
    70                     or ref $_[0] eq 'PPI::Statement::Sub'; 
     70                    or ref $_[0] eq 'PPI::Statement::Sub' 
     71                    or ref $_[0] eq 'PPI::Statement'; 
    7172        } 
    7273    ); 
     
    9697        } elsif ( ref $thing eq 'PPI::Statement::Sub' ) { 
    9798            push @{ $cur_pkg->{methods} }, { name => $thing->name, line => $thing->location->[0] }; 
     99        } elsif ( ref $thing eq 'PPI::Statement' ) { 
     100            # last resort, let's analyse further down... 
     101            my $node = $thing->first_element; 
     102 
     103            # Moose attribute declaration 
     104            if ( $node->isa('PPI::Token::Word') && $node->content eq 'has' ) { 
     105                push @{ $cur_pkg->{attributes} }, { name => $thing->child(2)->content, line => $thing->location->[0] }; 
     106                next; 
     107            } 
    98108        } 
    99109    } 
     
    230240            ) 
    231241        ); 
    232         foreach my $type (qw(pragmata modules methods)) { 
     242        foreach my $type (qw(pragmata modules attributes methods)) { 
    233243            _add_subtree( $outlinebar, $pkg, $type, $branch ); 
    234244        } 
Note: See TracChangeset for help on using the changeset viewer.