Author: pmichaud
Date: Fri Jan  2 14:58:52 2009
New Revision: 34838

Modified:
   trunk/runtime/parrot/library/P6object.pir

Log:
[p6object]:  Add 'get_proto' method to obtain a protoobject (if it exists).


Modified: trunk/runtime/parrot/library/P6object.pir
==============================================================================
--- trunk/runtime/parrot/library/P6object.pir   (original)
+++ trunk/runtime/parrot/library/P6object.pir   Fri Jan  2 14:58:52 2009
@@ -507,6 +507,28 @@
 .end
 
 
+=item get_proto(name)
+
+Retrieve the protoobject for C<name>.  Return null if no
+protoobject exists, or whatever is present isn't a protoobject.
+
+=cut
+
+.sub 'get_proto' :method
+    .param string name
+    .local pmc ns, proto
+    ns = split '::', name
+    $S0 = pop ns
+    proto = get_hll_global ns, $S0
+    if null proto goto done
+    $I0 = isa proto, ['P6protoobject']
+    if $I0 goto done
+    null proto
+  done:
+    .return (proto)
+.end
+
+
 =item get_parrotclass(x)
 
 Multimethod helper to return the parrotclass for C<x>.

Reply via email to