Revision
4333
Author
lsansonetti@apple.com
Date
2010-07-08 16:39:15 -0700 (Thu, 08 Jul 2010)

Log Message

support for splat when clauses inside empty-case statements (don't ask me why)

Modified Paths

Diff

Modified: MacRuby/trunk/compiler.cpp (4332 => 4333)


--- MacRuby/trunk/compiler.cpp	2010-07-08 22:56:52 UTC (rev 4332)
+++ MacRuby/trunk/compiler.cpp	2010-07-08 23:39:15 UTC (rev 4333)
@@ -529,6 +529,9 @@
 Value *
 RoxorCompiler::compile_when_splat(Value *comparedToVal, Value *splatVal)
 {
+    if (comparedToVal == NULL) {
+	return splatVal;
+    }
     GlobalVariable *is_redefined = GET_CORE()->redefined_op_gvar(selEqq, true);
     Value *args[] = {
 	new LoadInst(is_redefined, "", bb),
@@ -4525,7 +4528,7 @@
 
 		assert(subnode != NULL);
 		assert(nd_type(subnode) == NODE_WHEN);
-		while ((subnode != NULL) && (nd_type(subnode) == NODE_WHEN)) {
+		while (subnode != NULL && nd_type(subnode) == NODE_WHEN) {
 		    NODE *valueNode = subnode->nd_head;
 		    assert(valueNode != NULL);