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

[svn:parrot] r35363 - trunk/languages/perl6/src/builtins

From:
pmichaud
Date:
January 10, 2009 14:27
Subject:
[svn:parrot] r35363 - trunk/languages/perl6/src/builtins
Message ID:
20090110222715.66A1FCB9F9@x12.develooper.com
Author: pmichaud
Date: Sat Jan 10 14:27:14 2009
New Revision: 35363

Modified:
   trunk/languages/perl6/src/builtins/assign.pir

Log:
[rakudo]:  Make assignment smarter about ObjectRef vs. Perl6Scalar.


Modified: trunk/languages/perl6/src/builtins/assign.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/assign.pir	(original)
+++ trunk/languages/perl6/src/builtins/assign.pir	Sat Jan 10 14:27:14 2009
@@ -49,7 +49,7 @@
 .sub 'infix:=' :multi(['Perl6Array'], _)
     .param pmc cont
     .param pmc source
-    $I0 = isa cont, 'ObjectRef'
+    $I0 = isa cont, 'Perl6Scalar'
     unless $I0 goto cont_array
     # FIXME: use a :subid to directly lookup and call infix:=(_,_) above
     $P0 = get_hll_global 'Object'
@@ -57,6 +57,12 @@
     .tailcall 'infix:='(cont, source)
 
   cont_array:
+    .local pmc ro
+    getprop ro, 'readonly', cont
+    if null ro goto ro_ok
+    unless ro goto ro_ok
+    'die'('Cannot assign to readonly variable.')
+  ro_ok:
     .tailcall cont.'!STORE'(source)
 .end
 
@@ -64,7 +70,7 @@
 .sub 'infix:=' :multi(['Perl6Hash'], _)
     .param pmc cont
     .param pmc source
-    $I0 = isa cont, 'ObjectRef'
+    $I0 = isa cont, 'Perl6Scalar'
     unless $I0 goto cont_hash
     # FIXME: use a :subid to directly lookup and call infix:=(_,_) above
     $P0 = get_hll_global 'Object'
@@ -72,6 +78,12 @@
     .tailcall 'infix:='(cont, source)
 
   cont_hash:
+    .local pmc ro
+    getprop ro, 'readonly', cont
+    if null ro goto ro_ok
+    unless ro goto ro_ok
+    'die'('Cannot assign to readonly variable.')
+  ro_ok:
     .tailcall cont.'!STORE'(source)
 .end
 
@@ -100,7 +112,7 @@
     unless i < $I0 goto mark_done
     .local pmc cont
     cont = list[i]
-    $I0 = isa cont, ['ObjectRef']
+    $I0 = isa cont, ['Perl6Scalar']
     if $I0 goto mark_next
     $I0 = isa cont, ['Perl6Array']
     if $I0 goto mark_next
@@ -138,7 +150,7 @@
     .local pmc cont
     cont = shift it
     setprop cont, 'target', pmcnull
-    $I0 = isa cont, 'ObjectRef'
+    $I0 = isa cont, 'Perl6Scalar'
     if $I0 goto assign_scalar
     $I0 = isa cont, 'Perl6Array'
     if $I0 goto assign_array



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