cvsuser 05/03/10 01:57:13
Modified: src objects.c
t/pmc objects.t
Log:
mulitple anon subclasses - #33101
Revision Changes Path
1.134 +8 -4 parrot/src/objects.c
Index: objects.c
===================================================================
RCS file: /cvs/public/parrot/src/objects.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -r1.133 -r1.134
--- objects.c 10 Mar 2005 08:06:34 -0000 1.133
+++ objects.c 10 Mar 2005 09:57:12 -0000 1.134
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: objects.c,v 1.133 2005/03/10 08:06:34 leo Exp $
+$Id: objects.c,v 1.134 2005/03/10 09:57:12 leo Exp $
=head1 NAME
@@ -315,9 +315,13 @@
VTABLE_set_string_native(interpreter, classname_pmc,
child_class_name);
}
else {
- /* XXX make unique names */
- child_class_name = string_make(interpreter,
- "\0\0anonymous", 11, "iso-8859-1", 0);
+ /* XXX not really threadsafe but good enough for now */
+ static int anon_count;
+
+ child_class_name = Parrot_sprintf_c(interpreter, "%c%canon_%d",
+ 0, 0, ++anon_count);
+ //child_class_name = string_make(interpreter,
+ // "\0\0anonymous", 11, "iso-8859-1", 0);
VTABLE_set_string_native(interpreter, classname_pmc,
child_class_name );
}
1.69 +14 -3 parrot/t/pmc/objects.t
Index: objects.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/objects.t,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- objects.t 4 Mar 2005 17:49:11 -0000 1.68
+++ objects.t 10 Mar 2005 09:57:13 -0000 1.69
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: objects.t,v 1.68 2005/03/04 17:49:11 bernhard Exp $
+# $Id: objects.t,v 1.69 2005/03/10 09:57:13 leo Exp $
=head1 NAME
@@ -16,7 +16,7 @@
=cut
-use Parrot::Test tests => 59;
+use Parrot::Test tests => 60;
use Test::More;
output_is(<<'CODE', <<'OUTPUT', "findclass (base class)");
@@ -1230,7 +1230,7 @@
print "\n"
end
CODE
-/anonymous/
+/anon_\d+/
OUTPUT
output_is(<<'CODE', <<'OUTPUT', "get attrib by name");
@@ -1902,3 +1902,14 @@
CODE
/Can't create new ParrotObject/
OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "multpile anon classes - #33103");
+ newclass P0, "City"
+ subclass P1, P0
+ newclass P2, "State"
+ subclass P3, P2
+ print "ok\n"
+ end
+CODE
+ok
+OUTPUT