complex.c, rational.c: no backref
Since r37702, parsing complex and rational do not use regexp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6010d756c0
commit
b479a2d439
@ -1869,16 +1869,13 @@ string_to_c(VALUE self)
|
|||||||
static VALUE
|
static VALUE
|
||||||
nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
|
nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
|
||||||
{
|
{
|
||||||
VALUE a1, a2, backref;
|
VALUE a1, a2;
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "11", &a1, &a2);
|
rb_scan_args(argc, argv, "11", &a1, &a2);
|
||||||
|
|
||||||
if (NIL_P(a1) || (argc == 2 && NIL_P(a2)))
|
if (NIL_P(a1) || (argc == 2 && NIL_P(a2)))
|
||||||
rb_raise(rb_eTypeError, "can't convert nil into Complex");
|
rb_raise(rb_eTypeError, "can't convert nil into Complex");
|
||||||
|
|
||||||
backref = rb_backref_get();
|
|
||||||
rb_match_busy(backref);
|
|
||||||
|
|
||||||
if (RB_TYPE_P(a1, T_STRING)) {
|
if (RB_TYPE_P(a1, T_STRING)) {
|
||||||
a1 = string_to_c_strict(a1);
|
a1 = string_to_c_strict(a1);
|
||||||
}
|
}
|
||||||
@ -1887,8 +1884,6 @@ nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
|
|||||||
a2 = string_to_c_strict(a2);
|
a2 = string_to_c_strict(a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_backref_set(backref);
|
|
||||||
|
|
||||||
if (RB_TYPE_P(a1, T_COMPLEX)) {
|
if (RB_TYPE_P(a1, T_COMPLEX)) {
|
||||||
{
|
{
|
||||||
get_dat1(a1);
|
get_dat1(a1);
|
||||||
|
@ -2498,7 +2498,7 @@ rb_cstr_to_rat(const char *s, int strict) /* for complex's internal */
|
|||||||
static VALUE
|
static VALUE
|
||||||
nurat_s_convert(int argc, VALUE *argv, VALUE klass)
|
nurat_s_convert(int argc, VALUE *argv, VALUE klass)
|
||||||
{
|
{
|
||||||
VALUE a1, a2, backref;
|
VALUE a1, a2;
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "11", &a1, &a2);
|
rb_scan_args(argc, argv, "11", &a1, &a2);
|
||||||
|
|
||||||
@ -2515,9 +2515,6 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass)
|
|||||||
a2 = RCOMPLEX(a2)->real;
|
a2 = RCOMPLEX(a2)->real;
|
||||||
}
|
}
|
||||||
|
|
||||||
backref = rb_backref_get();
|
|
||||||
rb_match_busy(backref);
|
|
||||||
|
|
||||||
if (RB_FLOAT_TYPE_P(a1)) {
|
if (RB_FLOAT_TYPE_P(a1)) {
|
||||||
a1 = float_to_r(a1);
|
a1 = float_to_r(a1);
|
||||||
}
|
}
|
||||||
@ -2532,8 +2529,6 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass)
|
|||||||
a2 = string_to_r_strict(a2);
|
a2 = string_to_r_strict(a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_backref_set(backref);
|
|
||||||
|
|
||||||
if (RB_TYPE_P(a1, T_RATIONAL)) {
|
if (RB_TYPE_P(a1, T_RATIONAL)) {
|
||||||
if (argc == 1 || (k_exact_one_p(a2)))
|
if (argc == 1 || (k_exact_one_p(a2)))
|
||||||
return a1;
|
return a1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user