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

[svn:parrot] r35381 - in trunk/languages/perl6/src: builtins classes

From:
pmichaud
Date:
January 10, 2009 20:29
Subject:
[svn:parrot] r35381 - in trunk/languages/perl6/src: builtins classes
Message ID:
20090111042940.71C24CB9F9@x12.develooper.com
Author: pmichaud
Date: Sat Jan 10 20:29:39 2009
New Revision: 35381

Modified:
   trunk/languages/perl6/src/builtins/guts.pir
   trunk/languages/perl6/src/classes/Signature.pir

Log:
[rakudo]:  Final bits of array/hash parameter handling.


Modified: trunk/languages/perl6/src/builtins/guts.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/guts.pir	(original)
+++ trunk/languages/perl6/src/builtins/guts.pir	Sat Jan 10 20:29:39 2009
@@ -105,6 +105,24 @@
 .end
 
 
+=item !DEREF
+
+Helper function to dereference any chains
+
+=cut
+
+.sub '!DEREF'
+    .param pmc x
+  loop:
+    $I0 = isa x, ['ObjectRef']
+    unless $I0 goto done
+    x = deref x
+    goto loop
+  done:
+    .return (x)
+.end
+
+
 =item !SAMETYPE_EXACT
 
 Takes two types and returns true if they match exactly (not accounting for any

Modified: trunk/languages/perl6/src/classes/Signature.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Signature.pir	(original)
+++ trunk/languages/perl6/src/classes/Signature.pir	Sat Jan 10 20:29:39 2009
@@ -300,7 +300,8 @@
     $I0 = does orig, 'array'
     unless $I0 goto err_array
   param_array_1:
-    var = '!CALLMETHOD'('Array', orig)
+    var = '!DEREF'(orig)
+    var = '!CALLMETHOD'('Array', var)
     goto param_val_done
   param_hash:
     $I0 = does orig, 'Associative'
@@ -308,7 +309,8 @@
     $I0 = does orig, 'hash'
     unless $I0 goto err_hash
   param_hash_1:
-    var = '!CALLMETHOD'('Hash', orig)
+    var = '!DEREF'(orig)
+    var = '!CALLMETHOD'('Hash', var)
   param_val_done:
     ## handle readonly/copy traits
     $S0 = param['readtype']



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