Author: jonathan
Date: Fri Jul 18 08:36:49 2008
New Revision: 29586
Modified:
trunk/languages/perl6/src/classes/Object.pir
trunk/runtime/parrot/library/P6object.pir
Log:
[rakudo] Move WHENCE related things that were in P6Object.pir into the Rakudo
source tree (Object.pir).
Modified: trunk/languages/perl6/src/classes/Object.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Object.pir (original)
+++ trunk/languages/perl6/src/classes/Object.pir Fri Jul 18 08:36:49 2008
@@ -448,6 +448,87 @@
.return how.method_name(self, pos_args :flat, named_args :flat :named)
.end
+
+.namespace ['P6protoobject']
+
+=back
+
+=head2 Methods on P6protoobject.
+
+=item WHENCE()
+
+Returns the protoobject's autovivification closure.
+
+=cut
+
+.sub 'WHENCE' :method
+ .local pmc props, whence
+ props = getattribute self, '%!properties'
+ if null props goto ret_undef
+ whence = props['WHENCE']
+ if null whence goto ret_undef
+ .return (whence)
+ ret_undef:
+ whence = new 'Undef'
+ .return (whence)
+.end
+
+
+=item get_pmc_keyed(key) (vtable method)
+
+Returns a proto-object with an autovivification closure attached to it.
+
+=cut
+
+.sub get_pmc_keyed :vtable :method
+ .param pmc what
+
+ # We'll build auto-vivification hash of values.
+ .local pmc WHENCE, key, val
+ WHENCE = new 'Hash'
+
+ # What is it?
+ $S0 = what.'WHAT'()
+ if $S0 == 'Pair' goto from_pair
+ if $S0 == 'List' goto from_list
+ 'die'("Auto-vivification closure did not contain a Pair")
+
+ from_pair:
+ # Just a pair.
+ key = what.'key'()
+ val = what.'value'()
+ WHENCE[key] = val
+ goto done_whence
+
+ from_list:
+ # List.
+ .local pmc list_iter, cur_pair
+ list_iter = new 'Iterator', what
+ list_iter_loop:
+ unless list_iter goto done_whence
+ cur_pair = shift list_iter
+ key = cur_pair.'key'()
+ val = cur_pair.'value'()
+ WHENCE[key] = val
+ goto list_iter_loop
+ done_whence:
+
+ # Now create a clone of the protoobject.
+ .local pmc protoclass, res, props, tmp
+ protoclass = class self
+ res = new protoclass
+
+ # Attach the WHENCE property.
+ props = getattribute self, '%!properties'
+ unless null props goto have_props
+ props = new 'Hash'
+ have_props:
+ props['WHENCE'] = WHENCE
+ setattribute res, '%!properties', props
+
+ .return (res)
+.end
+
=back
=cut
Modified: trunk/runtime/parrot/library/P6object.pir
==============================================================================
--- trunk/runtime/parrot/library/P6object.pir (original)
+++ trunk/runtime/parrot/library/P6object.pir Fri Jul 18 08:36:49 2008
@@ -529,81 +529,6 @@
.end
-=item WHENCE()
-
-Returns the protoobject's autovivification closure.
-
-=cut
-
-.sub 'WHENCE' :method
- .local pmc props, whence
- props = getattribute self, '%!properties'
- if null props goto ret_undef
- whence = props['WHENCE']
- if null whence goto ret_undef
- .return (whence)
- ret_undef:
- whence = new 'Undef'
- .return (whence)
-.end
-
-
-=item get_pmc_keyed(key) (vtable method)
-
-Returns a proto-object with an autovivification closure attached to it.
-
-=cut
-
-.sub get_pmc_keyed :vtable :method
- .param pmc what
-
- # We'll build auto-vivification hash of values.
- .local pmc WHENCE, key, val
- WHENCE = new 'Hash'
-
- # What is it?
- $S0 = what.'WHAT'()
- if $S0 == 'Pair' goto from_pair
- if $S0 == 'List' goto from_list
- 'die'("Auto-vivification closure did not contain a Pair")
-
- from_pair:
- # Just a pair.
- key = what.'key'()
- val = what.'value'()
- WHENCE[key] = val
- goto done_whence
-
- from_list:
- # List.
- .local pmc list_iter, cur_pair
- list_iter = new 'Iterator', what
- list_iter_loop:
- unless list_iter goto done_whence
- cur_pair = shift list_iter
- key = cur_pair.'key'()
- val = cur_pair.'value'()
- WHENCE[key] = val
- goto list_iter_loop
- done_whence:
-
- # Now create a clone of the protoobject.
- .local pmc protoclass, res, props, tmp
- protoclass = class self
- res = new protoclass
-
- # Attach the WHENCE property.
- props = getattribute self, '%!properties'
- unless null props goto have_props
- props = new 'Hash'
- have_props:
- props['WHENCE'] = WHENCE
- setattribute res, '%!properties', props
-
- .return (res)
-.end
-
-
=item ACCEPTS(topic)
=cut