[macruby-changes] [2469] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Sep 4 04:25:09 PDT 2009
Revision: 2469
http://trac.macosforge.org/projects/ruby/changeset/2469
Author: vincent.isambart at gmail.com
Date: 2009-09-04 04:25:05 -0700 (Fri, 04 Sep 2009)
Log Message:
-----------
fixed a bug in the 'case' with splat args
(it was doing :foo === Symbol instead of Symbol === :foo)
Modified Paths:
--------------
MacRuby/trunk/test_vm/case.rb
MacRuby/trunk/vm.cpp
Modified: MacRuby/trunk/test_vm/case.rb
===================================================================
--- MacRuby/trunk/test_vm/case.rb 2009-09-04 05:31:17 UTC (rev 2468)
+++ MacRuby/trunk/test_vm/case.rb 2009-09-04 11:25:05 UTC (rev 2469)
@@ -27,4 +27,5 @@
}
assert '1', 'p case 1 when *[2, 1] then 1 else 2 end'
assert '1', 'a = [7, 8]; p case 1 when *a, *[4, 5], 1 then 1 else 2 end'
-assert '1', 'p case :foo when *[Symbol] then 1 else 2 end'
\ No newline at end of file
+assert '1', 'p case :foo when *[Symbol] then 1 else 2 end'
+assert '1', 'class String; def ===(x) false end end; p case :foo when *[Symbol] then 1 else 2 end'
Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp 2009-09-04 05:31:17 UTC (rev 2468)
+++ MacRuby/trunk/vm.cpp 2009-09-04 11:25:05 UTC (rev 2469)
@@ -3268,7 +3268,8 @@
int count = RARRAY_LEN(ary);
if (overriden == 0) {
for (int i = 0; i < count; ++i) {
- if (RTEST(rb_vm_fast_eqq(cache, comparedTo, RARRAY_AT(ary, i)))) {
+ VALUE o = RARRAY_AT(ary, i);
+ if (RTEST(rb_vm_fast_eqq(cache, o, comparedTo))) {
return Qtrue;
}
}
@@ -3276,7 +3277,7 @@
else {
for (int i = 0; i < count; ++i) {
VALUE o = RARRAY_AT(ary, i);
- if (RTEST(rb_vm_dispatch(cache, comparedTo, selEqq, NULL, 0, 1, &o))) {
+ if (RTEST(rb_vm_dispatch(cache, o, selEqq, NULL, 0, 1, comparedTo))) {
return Qtrue;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090904/11de00c8/attachment-0001.html>
More information about the macruby-changes
mailing list