Revision: 3721 http://trac.macosforge.org/projects/ruby/changeset/3721 Author: lsansonetti@apple.com Date: 2010-03-09 17:46:19 -0800 (Tue, 09 Mar 2010) Log Message: ----------- fixed a bug in Match#[] Modified Paths: -------------- MacRuby/branches/icu/re.cpp Modified: MacRuby/branches/icu/re.cpp =================================================================== --- MacRuby/branches/icu/re.cpp 2010-03-10 01:29:16 UTC (rev 3720) +++ MacRuby/branches/icu/re.cpp 2010-03-10 01:46:19 UTC (rev 3721) @@ -1371,10 +1371,14 @@ rb_scan_args(argc, argv, "11", &backref, &rest); if (NIL_P(rest)) { - const int pos = match_backref_number(rcv, backref, false); - return rb_reg_nth_match(pos, rcv); + switch (TYPE(backref)) { + case T_STRING: + case T_SYMBOL: + case T_FIXNUM: + const int pos = match_backref_number(rcv, backref, false); + return rb_reg_nth_match(pos, rcv); + } } - return rb_ary_aref(match_to_a(rcv, 0), 0, argc, argv); }
participants (1)
-
source_changes@macosforge.org