Devel-Chitin

 view release on metacpan or  search on metacpan

lib/Devel/Chitin/Location.pm  view on Meta::CPAN

package Devel::Chitin::Location;

use strict;
use warnings;

our $VERSION = '0.22';

use Carp;
use Scalar::Util qw(weaken reftype);

sub new {
    my $class = shift;
    my %props = @_;

    my @props = $class->_required_properties;
    foreach my $prop ( @props ) {
        unless (exists $props{$prop}) {
            Carp::croak("$prop is a required property");
        }

lib/Devel/Chitin/OpTree.pm  view on Meta::CPAN

package Devel::Chitin::OpTree;

use strict;
use warnings;

our $VERSION = '0.22';

use Carp;
use Scalar::Util qw(blessed reftype weaken refaddr);
use B qw(ppname);

use Devel::Chitin::OpTree::UNOP;
use Devel::Chitin::OpTree::SVOP;
use Devel::Chitin::OpTree::PADOP;
use Devel::Chitin::OpTree::COP;
use Devel::Chitin::OpTree::PVOP;
use Devel::Chitin::OpTree::METHOP;
use Devel::Chitin::OpTree::BINOP;
use Devel::Chitin::OpTree::LOGOP;

lib/Devel/Chitin/OpTree.pm  view on Meta::CPAN

    my($start_op, $cv) = _determine_start_of($start);

    # adapted from B::walkoptree_slow
    my @parents;
    my $build_walker;
    $build_walker = sub {
        my $op = shift;

        my $self = $class->new(op => $op, cv => $cv);
        $objs_for_op{$$op} = $self;
        weaken $objs_for_op{$$op};

        my @children;
        if ($$op && ($op->flags & B::OPf_KIDS)) {
            unshift(@parents, $self);
            for (my $kid_op = $op->first; $$kid_op; $kid_op = $kid_op->sibling) {
                push @children, $build_walker->($kid_op);
            }
            shift(@parents);
        }



( run in 0.388 second using v1.01-cache-2.11-cpan-65fba6d93b7 )