Skip to content

Commit

Permalink
both extract full qualified and simple parent class names
Browse files Browse the repository at this point in the history
Signed-off-by: satanson <ranpanf@gmail.com>
  • Loading branch information
satanson committed Jan 8, 2024
1 parent b1cca75 commit af0564f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
34 changes: 14 additions & 20 deletions cpptree.pl
Original file line number Diff line number Diff line change
Expand Up @@ -535,27 +535,21 @@ ()
last;
}
for my $e (@parent_matches) {
my ($fileline, $child, $parent) = @$e;
if (!defined($tree->{$parent})) {
$tree->{$parent} = [];
}

if (!exists $table{$parent}) {
$table{$parent} = [ "out-of-tree" ];
}
my ($fileline, $child, $parent0) = @$e;
my $parent1 = [ split /\s*::\s*/, $parent0 ]->[-1];
my @parents = keys %{+{$parent0 => 1, $parent1 => 2}};
for my $parent (@parents) {
if (!defined($tree->{$parent})) {
$tree->{$parent} = [];
}

if ($child ne $parent) {
push @{$tree->{$parent}}, $e;
}
my $simple_parent = ($parent =~ /\b(\w+)\b$/g,$1);
if ($simple_parent eq $parent) {
next;
}
if (!exists $table{$simple_parent}) {
$table{$simple_parent} = [ "out-of-tree" ];
}
if ($child ne $simple_parent) {
push @{$tree->{$simple_parent}}, $e;
if (!exists $table{$parent}) {
$table{$parent} = [ "out-of-tree" ];
}

if ($child ne $parent) {
push @{$tree->{$parent}}, $e;
}
}
}
}
Expand Down
24 changes: 14 additions & 10 deletions javatree.pl
Original file line number Diff line number Diff line change
Expand Up @@ -532,17 +532,21 @@ ()
next;
}
for my $e (@parent_matches) {
my ($fileline, $child, $parent) = @$e;
if (!defined($tree->{$parent})) {
$tree->{$parent} = [];
}

if (!exists $table{$parent}) {
$table{$parent} = [ "out-of-tree" ];
}
my ($fileline, $child, $parent0) = @$e;
my $parent1 = [split /\s*\.\s*/,$parent0]->[-1];
my @parents = keys %{+{$parent0 => 1, $parent1 => 2}};
for my $parent (@parents) {
if (!defined($tree->{$parent})) {
$tree->{$parent} = [];
}

if ($child ne $parent) {
push @{$tree->{$parent}}, $e;
if (!exists $table{$parent}) {
$table{$parent} = [ "out-of-tree" ];
}

if ($child ne $parent) {
push @{$tree->{$parent}}, $e;
}
}
}
}
Expand Down

0 comments on commit af0564f

Please sign in to comment.