[macruby-changes] [MacRuby/MacRuby] 998999: fix the MatchData#[] behavior if passed a negative...
GitHub
noreply at github.com
Mon Aug 27 02:24:11 PDT 2012
Branch: refs/heads/master
Home: https://github.com/MacRuby/MacRuby
Commit: 998999953decfd1162cef517fa87498e99897c21
https://github.com/MacRuby/MacRuby/commit/998999953decfd1162cef517fa87498e99897c21
Author: Watson <watson1978 at gmail.com>
Date: 2012-08-27 (Mon, 27 Aug 2012)
Changed paths:
M re.c
Log Message:
-----------
fix the MatchData#[] behavior if passed a negative Fixnum object as index
In below case, MatchData#[] always returns a nil:
index < 0 &&
(matched count) + index >= 0
Sample code:
```
str = 'foo bar baz'
m = str.match(/\w+/)
p m[-1] #=> expect "foo", but nil
```
This fix above behavior.
More information about the macruby-changes
mailing list