Permalink
Browse files

Implement foreign namespace protocol

I beleive this to be the last critical piece for Rakudo work.
  • Loading branch information...
1 parent 5fa07ce commit c389906f25ac2905eb4f9e58a952bab7cfdcf59c @sorear sorear committed Apr 25, 2010
Showing with 31 additions and 0 deletions.
  1. +20 −0 nt/namespace.t
  2. +11 −0 perl5.pir
View
@@ -0,0 +1,20 @@
+# vim: ft=perl6
+
+plan(2);
+
+pir::load_bytecode("perl5.pir");
+my $p5 := pir::compreg__ps("perl5");
+
+$p5.make_interp('
+ package Foo::Bar;
+ sub Method {
+ my ($self, $x, $y) = @_;
+ return $x + $y;
+ }
+')();
+
+my $ns := $p5.get_namespace('Foo::Bar');
+
+ok(pir::defined($ns), "can get namespaces for packages");
+
+ok($ns.Method(1,3,7) == 4, "can call package methods");
View
@@ -189,6 +189,17 @@ Implements the PDD-31 library loading interface.
.return (name_str)
.end
+.sub 'get_namespace' :method
+ .param pmc name
+
+ self.'!force'()
+
+ $P0 = getattribute self, '$!interp'
+ $P0 = $P0.'get_namespace'(name)
+
+ .return($P0)
+.end
+
.sub 'get_exports' :method
.param pmc module_name
.param pmc imports :slurpy

0 comments on commit c389906

Please sign in to comment.