1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* insns.def (concatarray, splatarray): use to_a instead of

to_splat.

* insnhelper.ci (caller_setup_args): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-12-01 05:20:06 +00:00
parent 6fafbfd63e
commit 2bbffcd6a4
8 changed files with 14 additions and 48 deletions

View file

@ -13,6 +13,13 @@ Sat Dec 1 13:24:47 2007 Koichi Sasada <ko1@atdot.net>
* bootstraptest/test_block.rb: ditto.
Sat Dec 1 09:44:32 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* insns.def (concatarray, splatarray): use to_a instead of
to_splat.
* insnhelper.ci (caller_setup_args): ditto.
Sat Dec 1 03:34:32 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (newline_node): always remove NODE_BEGIN.

View file

@ -3242,7 +3242,6 @@ Init_Array(void)
rb_define_method(rb_cArray, "to_s", rb_ary_inspect, 0);
rb_define_method(rb_cArray, "inspect", rb_ary_inspect, 0);
rb_define_method(rb_cArray, "to_a", rb_ary_to_a, 0);
rb_define_method(rb_cArray, "to_splat", rb_ary_to_a, 0);
rb_define_method(rb_cArray, "to_ary", rb_ary_to_ary_m, 0);
rb_define_method(rb_cArray, "frozen?", rb_ary_frozen_p, 0);

View file

@ -113,8 +113,8 @@ assert_equal '1', 'a = [obj = Object.new]; a.size'
assert_equal 'true', 'a = [obj = Object.new]; a[0] == obj'
assert_equal '5', 'a = [1,2,3]; a[1] = 5; a[1]'
assert_equal 'bar', '[*:foo];:bar'
assert_equal '[1, 2]', 'def nil.to_splat; [2]; end; [1, *nil]'
assert_equal '[1, 2]', 'def nil.to_splat; [1, 2]; end; [*nil]'
assert_equal '[1, 2]', 'def nil.to_a; [2]; end; [1, *nil]'
assert_equal '[1, 2]', 'def nil.to_a; [1, 2]; end; [*nil]'
assert_equal '[0, 1, {2=>3}]', '[0, *[1], 2=>3]', "[ruby-dev:31592]"

View file

@ -365,19 +365,6 @@ enumerator_with_index(VALUE obj)
enumerator_with_index_i, (VALUE)&memo);
}
/*
* call-seq:
* e.to_splat => array
*
* Convert this enumerator object to an array to splat.
*/
static VALUE
enumerator_to_splat(VALUE obj)
{
return rb_convert_type(obj, T_ARRAY, "Array", "to_a");
}
static VALUE
next_ii(VALUE i, VALUE obj)
{
@ -475,7 +462,6 @@ Init_Enumerator(void)
rb_define_method(rb_cEnumerator, "initialize_copy", enumerator_init_copy, 1);
rb_define_method(rb_cEnumerator, "each", enumerator_each, 0);
rb_define_method(rb_cEnumerator, "with_index", enumerator_with_index, 0);
rb_define_method(rb_cEnumerator, "to_splat", enumerator_to_splat, 0);
rb_define_method(rb_cEnumerator, "next", enumerator_next, 0);
rb_define_method(rb_cEnumerator, "rewind", enumerator_rewind, 0);

View file

@ -236,7 +236,7 @@ caller_setup_args(rb_thread_t *th, rb_control_frame_t *cfp, VALUE flag,
VALUE ary = *(cfp->sp - 1);
VALUE *ptr;
int i;
VALUE tmp = rb_check_convert_type(ary, T_ARRAY, "Array", "to_splat");
VALUE tmp = rb_check_convert_type(ary, T_ARRAY, "Array", "to_a");
if (NIL_P(tmp)) {
/* do nothing */

View file

@ -468,8 +468,8 @@ concatarray
(VALUE ary)
{
VALUE ary2 = ary2st;
VALUE tmp1 = rb_check_convert_type(ary1, T_ARRAY, "Array", "to_splat");
VALUE tmp2 = rb_check_convert_type(ary2, T_ARRAY, "Array", "to_splat");
VALUE tmp1 = rb_check_convert_type(ary1, T_ARRAY, "Array", "to_a");
VALUE tmp2 = rb_check_convert_type(ary2, T_ARRAY, "Array", "to_a");
if (NIL_P(tmp1)) {
tmp1 = rb_ary_new3(1, ary1);
@ -488,7 +488,7 @@ concatarray
/**
@c put
@e splat array
@j ary to_splat
@j ary to_a
*/
DEFINE_INSN
splatarray
@ -496,7 +496,7 @@ splatarray
(VALUE ary)
(VALUE obj)
{
VALUE tmp = rb_check_convert_type(ary, T_ARRAY, "Array", "to_splat");
VALUE tmp = rb_check_convert_type(ary, T_ARRAY, "Array", "to_a");
if (NIL_P(tmp)) {
tmp = rb_ary_new3(1, ary);
}

View file

@ -782,16 +782,6 @@ nil_to_s(VALUE obj)
* nil.to_a #=> []
*/
/*
* Document-method: to_splat
*
* call-seq:
* nil.to_splat => []
*
* Always returns an empty array.
*
*/
static VALUE
nil_to_a(VALUE obj)
{
@ -2382,7 +2372,6 @@ Init_Object(void)
rb_define_method(rb_cNilClass, "to_f", nil_to_f, 0);
rb_define_method(rb_cNilClass, "to_s", nil_to_s, 0);
rb_define_method(rb_cNilClass, "to_a", nil_to_a, 0);
rb_define_method(rb_cNilClass, "to_splat", nil_to_a, 0);
rb_define_method(rb_cNilClass, "inspect", nil_inspect, 0);
rb_define_method(rb_cNilClass, "&", false_and, 1);
rb_define_method(rb_cNilClass, "|", false_or, 1);

15
range.c
View file

@ -650,19 +650,6 @@ range_to_s(VALUE range)
return str;
}
/*
* call-seq:
* rng.to_splat => array
*
* Convert this range object to an array to splat.
*/
static VALUE
range_to_splat(VALUE range)
{
return rb_convert_type(range, T_ARRAY, "Array", "to_a");
}
/*
* call-seq:
* rng.inspect => string
@ -908,12 +895,10 @@ Init_Range(void)
rb_define_method(rb_cRange, "max", range_max, 0);
rb_define_method(rb_cRange, "to_s", range_to_s, 0);
rb_define_method(rb_cRange, "inspect", range_inspect, 0);
rb_define_method(rb_cRange, "to_splat", range_to_splat, 0);
rb_define_method(rb_cRange, "exclude_end?", range_exclude_end_p, 0);
rb_define_method(rb_cRange, "member?", range_include, 1);
rb_define_method(rb_cRange, "include?", range_include, 1);
rb_define_method(rb_cRange, "cover?", range_cover, 1);
}