Author: rgrjr
Date: Sat May 26 16:51:19 2007
New Revision: 18646
Modified:
trunk/lib/Parrot/Pmc2c.pm
Log:
* lib/Parrot/Pmc2c.pm:
+ (methods): Warn about misspelled or unimplemented method names.
Modified: trunk/lib/Parrot/Pmc2c.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c.pm (original)
+++ trunk/lib/Parrot/Pmc2c.pm Sat May 26 16:51:19 2007
@@ -629,15 +629,16 @@
my ( $self, $line, $out_name ) = @_;
my $cout = "";
+ my %method_used_p;
# vtable methods
foreach my $method ( @{ $self->{vtable}{methods} } ) {
my $meth = $method->{meth};
- next if $meth eq 'class_init';
if ( $self->implements($meth) ) {
my $ret = $self->body( $method, $line, $out_name );
$line += count_newlines($ret);
$cout .= $ret;
+ $method_used_p{$meth}++;
}
}
@@ -647,6 +648,14 @@
my $ret = $self->body( $method, $line, $out_name );
$line += count_newlines($ret);
$cout .= $ret;
+ $method_used_p{$method->{meth}}++;
+ }
+
+ # check for misspelled or unimplemented method names.
+ foreach my $method ( @{ $self->{methods} } ) {
+ my $meth = $method->{meth};
+ warn "Cannot generate code for method '$meth', which is unknown.\n"
+ unless $method_used_p{$meth} || $meth eq 'class_init';
}
$cout =~ s/^\s+$//mg;