[macruby-changes] [3721] MacRuby/branches/icu/re.cpp

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 9 17:46:20 PST 2010


Revision: 3721
          http://trac.macosforge.org/projects/ruby/changeset/3721
Author:   lsansonetti at 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);
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100309/1333b7a5/attachment-0001.html>


More information about the macruby-changes mailing list