develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35086 - branches/rvar/languages/perl6/src/builtins

From:
jonathan
Date:
January 6, 2009 15:15
Subject:
[svn:parrot] r35086 - branches/rvar/languages/perl6/src/builtins
Message ID:
20090106231505.B8CA2CB9F9@x12.develooper.com
Author: jonathan
Date: Tue Jan  6 15:15:05 2009
New Revision: 35086

Modified:
   branches/rvar/languages/perl6/src/builtins/guts.pir

Log:
[rakudo] Get roles sort of working again.

Modified: branches/rvar/languages/perl6/src/builtins/guts.pir
==============================================================================
--- branches/rvar/languages/perl6/src/builtins/guts.pir	(original)
+++ branches/rvar/languages/perl6/src/builtins/guts.pir	Tue Jan  6 15:15:05 2009
@@ -380,18 +380,33 @@
     .param string name
     .param int also
 
-    .local pmc nsarray, ns
+    .local pmc nsarray
     $P0 = compreg 'Perl6'
     nsarray = $P0.'parse_name'(name)
-    ns = get_hll_namespace nsarray
 
-    .local pmc metaclass
+    if type == 'class' goto class
+    if type == 'grammar' goto class
+    if type == 'role' goto role
+    'die'("Unsupported package declarator ", type)
+
+  class:
+    .local pmc metaclass, ns
+    ns = get_hll_namespace nsarray
     if also goto is_also
     metaclass = newclass ns
     .return (metaclass)
   is_also:
     metaclass = get_class ns
     .return (metaclass)
+
+  role:
+    .local pmc info, metarole
+    info = new 'Hash'
+    $P0 = nsarray[-1]
+    info['name'] = $P0
+    info['namespace'] = nsarray
+    metarole = new 'Role', info
+    .return (metarole)
 .end 
 
 
@@ -411,6 +426,18 @@
 .end
 
 
+=item !meta_compose(Role role)
+
+Compose the role.
+
+=cut
+
+.sub '!meta_compose' :multi(['Role'])
+    .param pmc role
+    # Currently, nothing to do.
+.end
+
+
 =item !meta_trait(metaclass, type, name)
 
 Add a trait with the given C<type> and C<name> to C<metaclass>.
@@ -443,7 +470,7 @@
     $P0 = $P0.'parse_name'(name)
     $S0 = pop $P0
     $P0 = get_hll_global $P0, $S0
-    say $P0
+    $P0 = get_class $P0
 
     ##  add it to the class.
     metaclass.'add_role'($P0)



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About