Skip to content

Commit 5c91854

Browse files
committed
fixup cpptree.pl java_calltree.pl
1 parent f53d9d2 commit 5c91854

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

java_calltree.pl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ ($$$$$$$$)
866866

867867
my @child_nodes = ();
868868
my $unique_name = $node->{file_info} . "::" . $node->{name};
869-
if (exists $pruned->{$unique_name}) {
869+
if (defined($pruned) && exists($pruned->{$unique_name})) {
870870
my $cached_node = $pruned->{$unique_name};
871871
# return undef if the current node is pruned
872872
if (!defined($cached_node)) {
@@ -887,29 +887,36 @@ ($$$$$$$$)
887887
}
888888

889889
@child_nodes = grep {
890-
my $real_node = $_;
891-
if (exists($_->{cache_key}) && exists($pruned->{$_->{cache_key}})) {
892-
$real_node = $pruned->{$_->{cache_key}};
890+
if (defined($pruned)) {
891+
my $real_node = $_;
892+
if (exists($_->{cache_key}) && exists($pruned->{$_->{cache_key}})) {
893+
$real_node = $pruned->{$_->{cache_key}};
894+
}
895+
(exists($real_node->{child}) && scalar(@{$real_node->{child}}) > 0) || $matched;
896+
}
897+
else {
898+
!undef;
893899
}
894-
(exists($real_node->{child}) && scalar(@{$real_node->{child}}) > 0) || $matched;
895900
} grep {defined($_)} @child_nodes;
896901

897902
if (@child_nodes) {
898903
$install_child->($node, [ @child_nodes ]);
899904
$node->{height} = max(map {$_->{height}} @child_nodes) + 1;
900905
$node->{count} = 1;
901-
$node->{cache_key} = $unique_name;
902-
$pruned->{$unique_name} = $node;
906+
if (defined($pruned)) {
907+
$node->{cache_key} = $unique_name;
908+
$pruned->{$unique_name} = $node;
909+
}
903910
return $node;
904911
}
905912
else {
906913
$install_child->($node, []);
907914
$node->{height} = 1;
908915
$node->{count} = 1;
909-
$node->{cache_key} = $unique_name;
916+
$node->{cache_key} = $unique_name if defined($pruned);
910917
my $opt_node = ($matched || $level == 1) ? $node : undef;
911918
if ($node->{leaf} eq "internal") {
912-
$pruned->{$unique_name} = $opt_node;
919+
$pruned->{$unique_name} = $opt_node if defined($pruned);
913920
}
914921
return $opt_node;
915922
}
@@ -1126,7 +1133,7 @@ ($$$$$)
11261133
simple_name => $name,
11271134
file_info => "",
11281135
};
1129-
return &sub_tree($called_graph, $node, 0, $depth, {}, $get_id_and_child, $install_child, $Global_pruned_cache);
1136+
return &sub_tree($called_graph, $node, 0, $depth, {}, $get_id_and_child, $install_child, undef);
11301137
}
11311138

11321139
sub fuzzy_called_tree($$$$$$) {

0 commit comments

Comments
 (0)