Skip to content

Commit

Permalink
fixed a bug in Match#[]
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/branches/icu@3721 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information
lrz committed Mar 10, 2010
1 parent 4c94a4e commit e38feb5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions re.cpp
Expand Up @@ -1371,10 +1371,14 @@ match_aref(VALUE rcv, SEL sel, int argc, VALUE *argv)
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);
}

Expand Down

0 comments on commit e38feb5

Please sign in to comment.