On Wed, 11 Jul 2007 23:49:34 -0700
Mark Glines (via RT) <[EMAIL PROTECTED]> wrote:
> The pmclass statement looks like:
>
> pmclass Perl6Str
> extends String
> does string
> dynpmc
> group perl6_group
> hll Perl6
> maps String {
>
> Interestingly, if I take all of the crud in this pmclass statement and
> stick them all on one line, like this:
>
> pmclass Perl6Str extends String does string dynpmc group perl6_group
> hll Perl6 maps String {
>
> ...The #line numbers do not change at all (get_string in the .c file
> is still #lined to 154), but now the get_string implementation in
> the .pmc file is also on line 154, so everything lines up.
I don't have a fix (yet), but here's a patch to add a couple of tests
for it. One test makes sure it emits the right #line when a complex
pmclass statement is all on one line, and the second makes sure #line is
adjusted when pmclass *isn't* on the same line.
The first test succeeds, the second one fails.
Mark
=== t/tools/pmc2c.t
==================================================================
--- t/tools/pmc2c.t (revision 21436)
+++ t/tools/pmc2c.t (local)
@@ -28,7 +28,7 @@
use Fatal qw{open close};
use Test::More;
-use Parrot::Test tests => 11;
+use Parrot::Test tests => 13;
use Parrot::Config;
my $pmc2c = join $PConfig{slash}, qw(. tools build pmc2c.pl);
@@ -181,6 +181,28 @@
);
END_C
+pmc2c_output_like( <<'END_PMC', <<'END_C', 'maps' );
+pmclass a hll dale maps Integer {
+ void init() {
+ }
+}
+END_PMC
+Parrot_a_init(Interp *interp, PMC *pmc)
+#line 2
+END_C
+
+pmc2c_output_like( <<'END_PMC', <<'END_C', 'maps' );
+pmclass a
+ hll dale
+ maps Integer {
+ void init() {
+ }
+}
+END_PMC
+Parrot_a_init(Interp *interp, PMC *pmc)
+#line 4
+END_C
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4