Author: jonathan
Date: Wed Nov 26 11:43:47 2008
New Revision: 33233

Modified:
   trunk/languages/perl6/src/builtins/guts.pir
   trunk/languages/perl6/src/parser/actions.pm

Log:
[rakudo] A crack at getting is copy to do the right thing. We may need to 
revisit this again later, as I've still not convinced myself it's going to do 
the right thing in every case (but didn't work out one where it won't yet). It 
passes all spectests that already passed and makes the man or boy example's use 
of is copy work, though.

Modified: trunk/languages/perl6/src/builtins/guts.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/guts.pir (original)
+++ trunk/languages/perl6/src/builtins/guts.pir Wed Nov 26 11:43:47 2008
@@ -123,6 +123,24 @@
 .end
 
 
+=item !COPYPARAM
+
+Copies a param for the is copy trait, taking account of any ObjectRef and
+dereferencing it so we really do copy the underlying value.
+
+=cut
+
+.sub '!COPYPARAM'
+    .param pmc target
+    .param pmc source
+    $I0 = isa source, 'ObjectRef'
+    unless $I0 goto no_deref
+    source = deref source
+  no_deref:
+    .tailcall 'infix:='(target, source)
+.end
+
+
 =item !DOTYPECHECK
 
 Checks that the value and the assignee are type-compatible and does the

Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Wed Nov 26 11:43:47 2008
@@ -1264,7 +1264,7 @@
                     PAST::Op.new(
                         :inline(
                             '    %r = new "Perl6Scalar"',
-                            '    "infix:="(%r, %0)'
+                            '    "!COPYPARAM"(%r, %0)'
                         ),
                         PAST::Var.new(
                             :name($parameter.name()),

Reply via email to