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

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

From:
pmichaud
Date:
January 11, 2009 07:12
Subject:
[svn:parrot] r35417 - trunk/languages/perl6/src/classes
Message ID:
20090111151149.4A463CB9F9@x12.develooper.com
Author: pmichaud
Date: Sun Jan 11 07:11:46 2009
New Revision: 35417

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

Log:
[rakudo]:  Handle numification and boolean test of protoobjects (RT #62006)


Modified: trunk/languages/perl6/src/classes/Protoobject.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Protoobject.pir	(original)
+++ trunk/languages/perl6/src/classes/Protoobject.pir	Sun Jan 11 07:11:46 2009
@@ -94,6 +94,7 @@
 
 =cut
 
+.namespace ['P6protoobject']
 .sub '!flatten' :method
     $P0 = new 'ResizablePMCArray'
     push $P0, self
@@ -108,18 +109,48 @@
 
 =cut
 
+.namespace ['P6protoobject']
 .sub '!IMMUTABLE' :method
     $P0 = get_hll_global ['Int'], 'Scalar'
     $P1 = self.'HOW'()
     $P1.'add_method'('Scalar', $P0, 'to'=>self)
 .end
 
+.namespace ['P6protoobject']
 .sub '!MUTABLE' :method
     $P0 = get_hll_global ['Perl6Object'], 'Scalar'
     $P1 = self.'HOW'()
     $P1.'add_method'('Scalar', $P0, 'to'=>self)
 .end
 
+=back
+
+=head2 Vtable functions
+
+=over
+
+=cut
+
+.namespace ['P6protoobject']
+.sub '' :vtable('get_bool') :method
+    $P0 = '!FAIL'('Use of protoobject as value')
+    $I0 = istrue $P0
+    .return ($I0)
+.end
+
+.namespace ['P6protoobject']
+.sub '' :vtable('get_integer') :method
+    $P0 = '!FAIL'('Use of protoobject as value')
+    $I0 = $P0
+    .return ($I0)
+.end
+
+.namespace ['P6protoobject']
+.sub '' :vtable('get_number') :method
+    $P0 = '!FAIL'('Use of protoobject as value')
+    $N0 = $P0
+    .return ($N0)
+.end
 
 =back
 



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