return 1 if ($type->{TYPE} eq "DECLARE"); # assume the worst
- if ($type->{TYPE} eq "TYPEDEF") {
- return can_contain_deferred($type->{DATA});
- }
+ return can_contain_deferred($type->{DATA}) if ($type->{TYPE} eq "TYPEDEF");
return 0 unless defined($type->{ELEMENTS});
- foreach my $x (@{$type->{ELEMENTS}}) {
- return 1 if ($x->{POINTERS});
- return 1 if (can_contain_deferred ($x));
+ foreach (@{$type->{ELEMENTS}}) {
+ return 1 if ($_->{POINTERS});
+ return 1 if (can_contain_deferred ($_->{TYPE}));
}
return 0;
use strict;
use warnings;
-use Test::More tests => 33;
+use Test::More tests => 34;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
ok(not can_contain_deferred({ TYPE => "TYPEDEF",
DATA => { TYPE => "STRUCT",
ELEMENTS => [ { TYPE => "uint32" } ]}}));
+ok(can_contain_deferred({ TYPE => "STRUCT",
+ ELEMENTS => [ { TYPE => "someunknowntype" } ]}));