cvsuser 04/11/11 06:16:33
Modified: lib/Parrot Pmc2c.pm
Log:
Generate accurate #line directives for the code copied verbatim from the PMC
file, and switch back to the generated file immediately at the end.
Revision Changes Path
1.57 +13 -9 parrot/lib/Parrot/Pmc2c.pm
Index: Pmc2c.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Pmc2c.pm,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- Pmc2c.pm 11 Nov 2004 12:35:54 -0000 1.56
+++ Pmc2c.pm 11 Nov 2004 14:16:33 -0000 1.57
@@ -1,5 +1,5 @@
# Copyright: 2004 The Perl Foundation. All Rights Reserved.
-# $Id: Pmc2c.pm,v 1.56 2004/11/11 12:35:54 nicholas Exp $
+# $Id: Pmc2c.pm,v 1.57 2004/11/11 14:16:33 nicholas Exp $
=head1 NAME
@@ -555,7 +555,6 @@
my $cout = "";
my $classname = $self->{class};
my $meth = $method->{meth};
- $cout .= $self->line_directive($method->{line}, $self->{file});
my $body = $method->{body};
$body =~ s/^\t/ /mg;
$body =~ s/^[ ]{4}//mg;
@@ -600,7 +599,12 @@
}
$cout .= $header_decls;
$cout .= $self->decl($classname, $method, 0);
+ # This is the part that comes from the PMC file.
+ $cout .= $self->line_directive($method->{line}, $self->{file});
$cout .= "{$standard_body\n}\n";
+ # We are back to generated code immediately here
+ $cout .= $self->line_directive(2 + $line + count_newlines($cout),
+ $out_name);
$cout .= $additional_bodies;
$cout .= "\n\n";
}
@@ -1039,7 +1043,7 @@
my ($self, $method, $line, $out_name) = @_;
my $meth = $method->{meth};
my $n = $self->{has_method}{$meth};
- return $self->SUPER::body($self->{methods}[$n]);
+ return $self->SUPER::body($self->{methods}[$n], $line, $out_name);
}
=back
@@ -1140,7 +1144,7 @@
# existing methods get emitted
if ($self->SUPER::implements($meth)) {
my $n = $self->{has_method}{$meth};
- return $self->SUPER::body($self->{methods}[$n]);
+ return $self->SUPER::body($self->{methods}[$n], $line, $out_name);
}
my $parameters = $method->{parameters};
my $n=0;
@@ -1215,7 +1219,7 @@
# existing methods get emitted
if ($self->SUPER::implements($meth)) {
my $n = $self->{has_method}{$meth};
- return $self->SUPER::body($self->{methods}[$n]);
+ return $self->SUPER::body($self->{methods}[$n], $line, $out_name);
}
my $parameters = $method->{parameters};
my $n=0;
@@ -1290,7 +1294,7 @@
# existing methods get emitted
if ($self->SUPER::implements($meth)) {
my $n = $self->{has_method}{$meth};
- return $self->SUPER::body($self->{methods}[$n]);
+ return $self->SUPER::body($self->{methods}[$n], $line, $out_name);
}
my $decl = $self->decl($self->{class}, $method, 0);
my $ret = "";
@@ -1350,7 +1354,7 @@
# existing methods get emitted
if ($self->SUPER::implements($meth)) {
my $n = $self->{has_method}{$meth};
- return $self->SUPER::body($self->{methods}[$n]);
+ return $self->SUPER::body($self->{methods}[$n], $line, $out_name);
}
my $decl = $self->decl($self->{class}, $method, 0);
my $ret = gen_ret($method);
@@ -1450,7 +1454,7 @@
# existing methods get emitted
if ($self->SUPER::implements($meth)) {
my $n = $self->{has_method}{$meth};
- return $self->SUPER::body($self->{methods}[$n]);
+ return $self->SUPER::body($self->{methods}[$n], $line, $out_name);
}
my $decl = $self->decl($self->{class}, $method, 0);
my $parameters = $method->{parameters};
@@ -1525,7 +1529,7 @@
# existing methods get emitted
if ($self->SUPER::implements($meth)) {
my $n = $self->{has_method}{$meth};
- return $self->SUPER::body($self->{methods}[$n]);
+ return $self->SUPER::body($self->{methods}[$n], $line, $out_name);
}
my $parameters = $method->{parameters};
my $n=0;