On Tue, Jul 1, 2008 at 4:44 PM, Patrick R. Michaud (via RT)
<[EMAIL PROTECTED]> wrote:
> $ cat x.pir
> .sub 'main'
> 'foo'()
> 'bar'()
> .end
>
> .sub 'foo'
> new $P0, "String"
> assign $P0, "abc"
> say $P0
> .end
>
> .sub 'bar' :lexid("abc")
> new $P0, "String"
> assign $P0, "abc"
> say $P0
> .end
>
> $ ./parrot x.pir
> abc
> abc"
> $
>
> Subs 'foo' and 'bar' are identical except for the :lexid
> attribute, yet they produce different output results.
This patch solves the issue, the lexid string was stored before truncating it.
--
Salu2
Index: compilers/imcc/pbc.c
===================================================================
--- compilers/imcc/pbc.c (revisión: 28897)
+++ compilers/imcc/pbc.c (copia de trabajo)
@@ -1161,8 +1161,8 @@
unit->lexid->name = str_dup(unit->lexid->name + 1);
/* Otherwise, create string constant for it. */
+ unit->lexid->name[strlen(unit->lexid->name) - 1] = 0;
unit->lexid->color = add_const_str(interp, unit->lexid);
- unit->lexid->name[strlen(unit->lexid->name) - 1] = 0;
}
sub->lexid = ct->constants[unit->lexid->color]->u.string;