Author: fperrad
Date: Sat Dec 13 08:46:24 2008
New Revision: 33859
Modified:
trunk/compilers/pct/src/PCT/Node.pir
trunk/src/pmc/capture.pmc
Log:
[pct]
Since r33585, PCT::Node is a Capture PMC instead of Capture_PIR.
So, remove the method clone from PCT::Node, and put a new one in Capture PMC.
Modified: trunk/compilers/pct/src/PCT/Node.pir
==============================================================================
--- trunk/compilers/pct/src/PCT/Node.pir (original)
+++ trunk/compilers/pct/src/PCT/Node.pir Sat Dec 13 08:46:24 2008
@@ -97,38 +97,6 @@
.end
-=item clone
-
-Create and returns a clone of a PAST node.
-
-=cut
-
-.sub 'clone' :vtable :method
- .local pmc res
- $S0 = typeof self
- $P0 = split ';', $S0
- res = new $P0
- .local pmc iter
- iter = self.'iterator'()
- iter_child_loop:
- unless iter goto iter_child_end
- $P0 = shift iter
- $P1 = clone $P0
- res.'push'($P1)
- goto iter_child_loop
- iter_child_end:
- iter = new 'Iterator', self
- iter_attr_loop:
- unless iter goto iter_attr_end
- $S0 = shift iter
- $P0 = iter[$S0]
- res[$S0] = $P0
- goto iter_attr_loop
- iter_attr_end:
- .return (res)
-.end
-
-
=item unshift(child)
Add C<child> to the beginning of the invocant's list of children.
Modified: trunk/src/pmc/capture.pmc
==============================================================================
--- trunk/src/pmc/capture.pmc (original)
+++ trunk/src/pmc/capture.pmc Sat Dec 13 08:46:24 2008
@@ -68,6 +68,31 @@
/*
+=item C<PMC *clone()>
+
+Creates an identical copy of the Capture.
+
+=cut
+
+*/
+
+ VTABLE PMC *clone() {
+ PMC *array, *hash;
+ PMC *dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
+ GET_ATTR_array(INTERP, SELF, array);
+ GET_ATTR_hash(INTERP, SELF, hash);
+ if (array)
+ array = VTABLE_clone(INTERP, array);
+ if (hash)
+ hash = VTABLE_clone(INTERP, hash);
+ SET_ATTR_array(INTERP, dest, array);
+ SET_ATTR_hash(INTERP, dest, hash);
+
+ return dest;
+ }
+
+/*
+
=item C<void set_number_keyed_int(INTVAL key, FLOATVAL value)>
=item C<void set_integer_keyed_int(INTVAL key, INTVAL value)>