Author: pmichaud
Date: Wed Jan 7 20:19:28 2009
New Revision: 35186
Modified:
branches/rvar2/languages/perl6/perl6.pir
branches/rvar2/languages/perl6/src/builtins/guts.pir
branches/rvar2/languages/perl6/src/parser/actions.pm
Log:
[rakudo]: A different approach to handling our class lies --
we maintain a %?CLASSMAP hash enumerating our lies and keep on lying.
We'll get rid of these lies when it's safe to tell Parrot the truth
(i.e., when RT #43419 and/or TT #71 are fixed).
Modified: branches/rvar2/languages/perl6/perl6.pir
==============================================================================
--- branches/rvar2/languages/perl6/perl6.pir (original)
+++ branches/rvar2/languages/perl6/perl6.pir Wed Jan 7 20:19:28 2009
@@ -106,6 +106,10 @@
$P0 = $P0.'new'( 'name'=>'metaclass', 'scope'=>'register' )
set_hll_global ['Perl6';'Grammar';'Actions'], '$?METACLASS', $P0
+ ## create the $?CLASSMAP hash
+ $P0 = new ['Hash']
+ set_hll_global ['Perl6';'Grammar';'Actions'], '%?CLASSMAP', $P0
+
## create a list of END blocks to be run
$P0 = new 'List'
set_hll_global ['Perl6'], '@?END_BLOCKS', $P0
Modified: branches/rvar2/languages/perl6/src/builtins/guts.pir
==============================================================================
--- branches/rvar2/languages/perl6/src/builtins/guts.pir (original)
+++ branches/rvar2/languages/perl6/src/builtins/guts.pir Wed Jan 7
20:19:28 2009
@@ -391,16 +391,13 @@
class:
.local pmc metaclass, ns
- if also goto is_also
ns = get_hll_namespace nsarray
+ if also goto is_also
metaclass = newclass ns
.return (metaclass)
is_also:
- .local pmc proto, p6meta
- $S0 = shift nsarray
- proto = get_hll_global nsarray, $S0
- p6meta = get_hll_global ['Perl6Object'], '$!P6META'
- .tailcall p6meta.'get_parrotclass'(proto)
+ metaclass = get_class ns
+ .return (metaclass)
role:
.local pmc info, metarole
Modified: branches/rvar2/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/rvar2/languages/perl6/src/parser/actions.pm (original)
+++ branches/rvar2/languages/perl6/src/parser/actions.pm Wed Jan 7
20:19:28 2009
@@ -3,6 +3,17 @@
class Perl6::Grammar::Actions ;
+# The %?CLASSMAP hash is used to identify those classes where we
+# "lie" about the class name in order to work around RT #43419 / TT #71.
+# When those are fixed and we can use the "true" Perl 6 classnames,
+# this can be removed. (See also the C<package_def> method below.)
+our %?CLASSMAP;
+%?CLASSMAP<Object> := 'Perl6Object';
+%?CLASSMAP<Array> := 'Perl6Array';
+%?CLASSMAP<Hash> := 'Perl6Hash';
+%?CLASSMAP<Pair> := 'Perl6Pair';
+%?CLASSMAP<Complex> := 'Perl6Complex';
+
method TOP($/) {
my $past := $( $<statement_block> );
$past.blocktype('declaration');
@@ -1332,8 +1343,12 @@
my $modulename := $<module_name>
?? ~$<module_name>[0] !!
$block.unique('!ANON');
+
+ # See note at top of file for %?CLASSMAP.
+ if %?CLASSMAP{$modulename} { $modulename := %?CLASSMAP{$modulename}; }
+
if ($modulename) {
- $block.namespace( PAST::Compiler.parse_name( $modulename ) );
+ $block.namespace( Perl6::Compiler.parse_name($modulename) );
}
if $key eq 'block' {