Author: jonathan
Date: Tue May  6 02:39:19 2008
New Revision: 27337

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

Log:
[rakudo] Make it so we can assign undef to typed variables. In the case where 
it's a typed variable we're assigning it to, stick the proto-object in there 
instead.

Modified: trunk/languages/perl6/src/builtins/guts.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/guts.pir (original)
+++ trunk/languages/perl6/src/builtins/guts.pir Tue May  6 02:39:19 2008
@@ -28,9 +28,19 @@
     if null type_info goto do_assign
     $I0 = type_info.ACCEPTS(value)
     if $I0 goto do_assign
+    $I0 = value.'isa'('Failure')
+    if $I0 goto do_assign_failure
     'die'("Type check failed")
 
-do_assign:
+  do_assign_failure:
+    # If it's a class type, we want to assign it's proto-object.
+    push_eh do_assign
+    $I0 = isa type_info, 'Perl6Protoobject'
+    unless $I0 goto do_assign
+    value = type_info
+    goto do_assign
+
+  do_assign:
     eq_addr assignee, value, no_copy
     copy assignee, value
     push_eh no_copy

Reply via email to