Author: pmichaud
Date: Mon Nov 10 09:54:02 2008
New Revision: 32496

Modified:
   trunk/languages/perl6/src/builtins/assign.pir
   trunk/languages/perl6/src/builtins/op.pir
   trunk/languages/perl6/src/parser/grammar-oper.pg

Log:
[rakudo]:  Some updates to assignment operators (RT #60452)


Modified: trunk/languages/perl6/src/builtins/assign.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/assign.pir       (original)
+++ trunk/languages/perl6/src/builtins/assign.pir       Mon Nov 10 09:54:02 2008
@@ -66,9 +66,21 @@
 .end
 
 
+.sub '!INIT_IF_PROTO'
+    .param pmc var
+    .param pmc val
+    $I0 = defined var
+    if $I0 goto done
+    'infix:='(var, val)
+  done:
+    .return ()
+.end
+
+
 .sub 'infix:~='
     .param pmc a
     .param pmc b
+    '!INIT_IF_PROTO'(a, '')
     concat a, b
     .return (a)
 .end
@@ -77,6 +89,7 @@
 .sub 'infix:+='
     .param pmc a
     .param pmc b
+    '!INIT_IF_PROTO'(a, 0)
     a += b
     .return (a)
 .end
@@ -85,6 +98,7 @@
 .sub 'infix:-='
     .param pmc a
     .param pmc b
+    '!INIT_IF_PROTO'(a, 0)
     a -= b
     .return (a)
 .end
@@ -93,6 +107,7 @@
 .sub 'infix:*='
     .param pmc a
     .param pmc b
+    '!INIT_IF_PROTO'(a, 1)
     a *= b
     .return (a)
 .end

Modified: trunk/languages/perl6/src/builtins/op.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/op.pir   (original)
+++ trunk/languages/perl6/src/builtins/op.pir   Mon Nov 10 09:54:02 2008
@@ -31,6 +31,7 @@
 .sub 'postfix:++' :multi(_)
     .param pmc a
     $P0 = clone a
+    '!INIT_IF_PROTO'(a, 0)
     inc a
     .return ($P0)
 .end
@@ -38,6 +39,7 @@
 .sub 'postfix:--' :multi(_)
     .param pmc a
     $P0 = clone a
+    '!INIT_IF_PROTO'(a, 0)
     dec a
     .return ($P0)
 .end
@@ -45,6 +47,7 @@
 
 .sub 'prefix:++' :multi(_)
     .param pmc a
+    '!INIT_IF_PROTO'(a, 0)
     inc a
     .return (a)
 .end
@@ -52,6 +55,7 @@
 
 .sub 'prefix:--' :multi(_)
     .param pmc a
+    '!INIT_IF_PROTO'(a, 0)
     dec a
     .return (a)
 .end

Modified: trunk/languages/perl6/src/parser/grammar-oper.pg
==============================================================================
--- trunk/languages/perl6/src/parser/grammar-oper.pg    (original)
+++ trunk/languages/perl6/src/parser/grammar-oper.pg    Mon Nov 10 09:54:02 2008
@@ -141,34 +141,34 @@
 proto infix:<:=> is precedence('i=') is pasttype('bind') { ... }
 proto infix:<::=> is equiv(infix:<:=>) { ... }
 proto infix:<.=> is equiv(infix:<:=>) { ... }
-proto infix:<~=> is equiv(infix:<:=>) { ... }
-proto infix:<+=> is equiv(infix:<:=>) { ... }
-proto infix:<-=> is equiv(infix:<:=>) { ... }
-proto infix:<*=> is equiv(infix:<:=>) { ... }
-proto infix:</=> is equiv(infix:<:=>) { ... }
-proto infix:<%=> is equiv(infix:<:=>) { ... }
-proto infix:<x=> is equiv(infix:<:=>) { ... }
-proto infix:<Y=> is equiv(infix:<:=>) { ... }
-proto infix:<**=> is equiv(infix:<:=>) { ... }
-proto infix:<xx=> is equiv(infix:<:=>) { ... }
-proto infix:<||=> is equiv(infix:<:=>) { ... }
-proto infix:<&&=> is equiv(infix:<:=>) { ... }
-proto infix:<//=> is equiv(infix:<:=>) { ... }
-proto infix:<^^=> is equiv(infix:<:=>) { ... }
-proto infix:«+<=» is equiv(infix:<:=>) { ... }
-proto infix:«+>=» is equiv(infix:<:=>) { ... }
-proto infix:<+|=> is equiv(infix:<:=>) { ... }
-proto infix:<+&=> is equiv(infix:<:=>) { ... }
-proto infix:<+^=> is equiv(infix:<:=>) { ... }
-proto infix:<~|=> is equiv(infix:<:=>) { ... }
-proto infix:<~&=> is equiv(infix:<:=>) { ... }
-proto infix:<~^=> is equiv(infix:<:=>) { ... }
-proto infix:<?|=> is equiv(infix:<:=>) { ... }
-proto infix:<?&=> is equiv(infix:<:=>) { ... }
-proto infix:<?^=> is equiv(infix:<:=>) { ... }
-proto infix:<|=> is equiv(infix:<:=>) { ... }
-proto infix:<&=> is equiv(infix:<:=>) { ... }
-proto infix:<^=> is equiv(infix:<:=>) { ... }
+proto infix:<~=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<+=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<-=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<*=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:</=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<%=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<x=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<Y=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<**=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<xx=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<||=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<&&=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<//=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<^^=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:«+<=» is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:«+>=» is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<+|=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<+&=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<+^=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<~|=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<~&=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<~^=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<?|=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<?&=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<?^=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<|=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<&=> is equiv(infix:<:=>) is lvalue(1) { ... }
+proto infix:<^=> is equiv(infix:<:=>) is lvalue(1) { ... }
 proto infix:«=>» is equiv(infix:<:=>) { ... }
 
 ## loose unary

Reply via email to