summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--array.c1
-rw-r--r--bootstraptest/test_literal.rb4
-rw-r--r--enumerator.c14
-rw-r--r--insnhelper.ci2
-rw-r--r--insns.def8
-rw-r--r--object.c11
-rw-r--r--range.c15
8 files changed, 14 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog
index ae29f93..07d8ddd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/array.c b/array.c
index b001067..db8c5bc 100644
--- a/array.c
+++ b/array.c
@@ -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);
diff --git a/bootstraptest/test_literal.rb b/bootstraptest/test_literal.rb
index 2efd415..3c94145 100644
--- a/bootstraptest/test_literal.rb
+++ b/bootstraptest/test_literal.rb
@@ -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]"
diff --git a/enumerator.c b/enumerator.c
index ffa892a..ea4fb9e 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -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);
diff --git a/insnhelper.ci b/insnhelper.ci
index 743cd64..d449980 100644
--- a/insnhelper.ci
+++ b/insnhelper.ci
@@ -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 */
diff --git a/insns.def b/insns.def
index 489a90d..623f2ac 100644
--- a/insns.def
+++ b/insns.def
@@ -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);
}
diff --git a/object.c b/object.c
index d0f104c..689e87a 100644
--- a/object.c
+++ b/object.c
@@ -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);
diff --git a/range.c b/range.c
index 6bc8dcd..b4b200c 100644
--- a/range.c
+++ b/range.c
@@ -652,19 +652,6 @@ range_to_s(VALUE range)
/*
* 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
*
* Convert this range object to a printable form (using
@@ -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);
-
}