Author: bernhard
Date: Tue Dec 30 05:53:16 2008
New Revision: 34645
Modified:
trunk/languages/pipp/src/common/guts.pir
trunk/languages/pipp/src/pct/actions.pm
Log:
[Pipp] Store the new class in the register 'def'
Modified: trunk/languages/pipp/src/common/guts.pir
==============================================================================
--- trunk/languages/pipp/src/common/guts.pir (original)
+++ trunk/languages/pipp/src/common/guts.pir Tue Dec 30 05:53:16 2008
@@ -57,6 +57,12 @@
.include 'except_types.pasm'
.include 'except_severity.pasm'
+=head2 return
+
+For returning a value from a function.
+
+=cut
+
.sub 'return'
.param pmc value :optional
.param int has_value :opt_flag
@@ -71,6 +77,24 @@
.return (value)
.end
+=item pipp_create_class(name)
+
+Internal helper method to create a class.
+See C<!keyword_class> in Rakudo.
+
+=cut
+
+.sub 'pipp_create_class'
+ .param string name
+ .local pmc class
+
+ # Create class.
+ $P0 = get_root_global ['parrot'], 'P6metaclass'
+ class = $P0.'new_class'(name)
+
+ .return (class)
+.end
+
=back
Modified: trunk/languages/pipp/src/pct/actions.pm
==============================================================================
--- trunk/languages/pipp/src/pct/actions.pm (original)
+++ trunk/languages/pipp/src/pct/actions.pm Tue Dec 30 05:53:16 2008
@@ -623,11 +623,19 @@
my $block := @?BLOCK.shift();
$block.namespace( $<CLASS_NAME><ident> );
$block.push(
- PAST::Stmts.new(
+ # Start of class definition; make PAST to create class object if
+ # we're creating a new class.
+ PAST::Op.new(
+ :pasttype('bind'),
+ PAST::Var.new(
+ :name('def'),
+ :scope('register'),
+ :isdecl(1)
+ ),
PAST::Op.new(
- :inline( "$P0 = get_root_global ['parrot'],
'P6metaclass'\n"
- ~ "$P0.'new_class'('" ~ $<CLASS_NAME> ~ "')\n" ),
- :pasttype( 'inline' )
+ :pasttype('call'),
+ :name('pipp_create_class'),
+ ~$<CLASS_NAME><ident>
)
)
);