develooper Front page | perl.cvs.parrot | Postings from November 2008

[svn:parrot] r32589 - trunk/languages/perl6/src/classes

From:
pmichaud
Date:
November 12, 2008 20:25
Subject:
[svn:parrot] r32589 - trunk/languages/perl6/src/classes
Message ID:
20081113042551.8BC55CBAC7@x12.develooper.com
Author: pmichaud
Date: Wed Nov 12 20:25:50 2008
New Revision: 32589

Modified:
   trunk/languages/perl6/src/classes/Object.pir

Log:
[rakudo]:  Add a .PARROTCLASS method, to report the real type.


Modified: trunk/languages/perl6/src/classes/Object.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Object.pir	(original)
+++ trunk/languages/perl6/src/classes/Object.pir	Wed Nov 12 20:25:50 2008
@@ -430,6 +430,29 @@
     .tailcall self.'WHERE'()
 .end
 
+=item 'PARROTCLASS'
+
+Report the object's true nature.
+
+=cut
+
+.sub 'PARROTCLASS' :method
+    .local pmc obj
+    .local string result
+    obj = self
+    result = ''
+    $I0 = isa obj, 'ObjectRef'
+    unless $I0 goto have_obj
+    result = 'ObjectRef -> '
+    obj = deref obj
+  have_obj:
+    $P0 = typeof obj
+    $S0 = $P0
+    result .= $S0
+    .return (result)
+.end
+
+
 =back
 
 =head2 Private methods



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