String#[]: float handling merged to #2677

parent 545c5eec
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "mruby/class.h" #include "mruby/class.h"
#include "mruby/range.h" #include "mruby/range.h"
#include "mruby/string.h" #include "mruby/string.h"
#include "mruby/numeric.h"
#include "mruby/re.h" #include "mruby/re.h"
const char mrb_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz"; const char mrb_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
...@@ -751,9 +750,6 @@ mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value indx) ...@@ -751,9 +750,6 @@ mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value indx)
mrb_regexp_check(mrb, indx); mrb_regexp_check(mrb, indx);
switch (mrb_type(indx)) { switch (mrb_type(indx)) {
case MRB_TT_FLOAT:
indx = mrb_flo_to_fixnum(mrb, indx);
/* fall through */
case MRB_TT_FIXNUM: case MRB_TT_FIXNUM:
idx = mrb_fixnum(indx); idx = mrb_fixnum(indx);
...@@ -780,6 +776,7 @@ num_index: ...@@ -780,6 +776,7 @@ num_index:
return mrb_nil_value(); return mrb_nil_value();
} }
} }
case MRB_TT_FLOAT:
default: default:
indx = mrb_Integer(mrb, indx); indx = mrb_Integer(mrb, indx);
if (mrb_nil_p(indx)) { if (mrb_nil_p(indx)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment