Author: pmichaud
Date: Sun Dec 14 18:02:57 2008
New Revision: 33907
Added:
trunk/languages/perl6/src/classes/Associative.pir
- copied unchanged from r33906,
/branches/assoc/languages/perl6/src/classes/Associative.pir
Modified:
trunk/languages/perl6/config/makefiles/root.in
trunk/languages/perl6/src/classes/Protoobject.pir
trunk/languages/perl6/src/parser/actions.pm
trunk/languages/perl6/t/spectest.data
Log:
[rakudo]: Merge associative branch into trunk.
Rakudo now supports slicing on hashes.
Modified: trunk/languages/perl6/config/makefiles/root.in
==============================================================================
--- trunk/languages/perl6/config/makefiles/root.in (original)
+++ trunk/languages/perl6/config/makefiles/root.in Sun Dec 14 18:02:57 2008
@@ -54,6 +54,7 @@
src/classes/Abstraction.pir \
src/classes/Protoobject.pir \
src/classes/Positional.pir \
+ src/classes/Associative.pir \
src/classes/Any.pir \
src/classes/Bool.pir \
src/classes/Str.pir \
Modified: trunk/languages/perl6/src/classes/Protoobject.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Protoobject.pir (original)
+++ trunk/languages/perl6/src/classes/Protoobject.pir Sun Dec 14 18:02:57 2008
@@ -50,6 +50,29 @@
=back
+=head2 Functions
+
+=over
+
+=item postcircumfix:<{ }>
+
+Return a clone of the protoobject with a new WHENCE property set.
+
+=cut
+
+.namespace ['P6protoobject']
+.sub 'postcircumfix:{ }' :method
+ .param pmc WHENCE :slurpy :named
+ .local pmc protoclass, proto
+ protoclass = typeof self
+ proto = new protoclass
+ setprop proto, '%!WHENCE', WHENCE
+ .return (proto)
+.end
+
+
+=back
+
=head2 Private methods
=over
@@ -77,59 +100,6 @@
=back
-=head2 Vtable functions
-
-=over
-
-=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 = iter 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
- setprop res, '%!WHENCE', WHENCE
- .return (res)
-.end
-
-=back
-
=cut
# Local Variables:
Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Sun Dec 14 18:02:57 2008
@@ -1529,29 +1529,20 @@
$past := build_call( $( $<semilist> ) );
$past.node($/);
$past.name('postcircumfix:[ ]');
- $past.pasttype('call');
}
elsif $key eq '( )' {
$past := build_call( $( $<semilist> ) );
$past.node($/);
}
elsif $key eq '{ }' {
- $past := PAST::Var.new(
- $( $<semilist> ),
- :scope('keyed'),
- :vivibase('Perl6Hash'),
- :viviself('Failure'),
- :node( $/ )
- );
+ $past := build_call( $( $<semilist> ) );
+ $past.node($/);
+ $past.name('postcircumfix:{ }');
}
elsif $key eq '< >' {
- $past := PAST::Var.new(
- $( $<quote_expression> ),
- :scope('keyed'),
- :vivibase('Perl6Hash'),
- :viviself('Failure'),
- :node( $/ )
- );
+ $past := build_call( $( $<quote_expression> ) );
+ $past.node($/);
+ $past.name('postcircumfix:{ }');
}
else {
$/.panic("postcircumfix " ~ $key ~ " not yet implemented");
Modified: trunk/languages/perl6/t/spectest.data
==============================================================================
--- trunk/languages/perl6/t/spectest.data (original)
+++ trunk/languages/perl6/t/spectest.data Sun Dec 14 18:02:57 2008
@@ -5,6 +5,8 @@
# we don't add some files here, although all tests might pass right now
#
# S03-operators/overflow.t - passes only if bignum lib is available
+# S03-operators/binding-arrays.t - regressed to allow slices
+# S03-operators/binding-hashes.t - regressed to allow slices
integration/lexical-array-in-inner-block.t
integration/lexicals-and-attributes.t
@@ -61,7 +63,6 @@
S03-operators/autoincrement.t
S03-operators/autovivification.t
S03-operators/binding-closure.t
-S03-operators/binding-hashes.t
S03-operators/binding-scalars.t
S03-operators/bit.t
S03-operators/chained-declarators.t