From d4301da342a50aa72cd930208d0dfc516f76eaff Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 7 May 2004 08:44:24 +0000 Subject: * parse.y (string_content): turn off NODE_NEWLINE flag to avoid unnecessary line trace for inlined expression. (ruby-bugs PR#1320) * numeric.c (flo_to_s): tweak output string based to preserve decimal point and to remove trailing zeros. [ruby-talk:97891] * string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM search. [ruby-talk:97342] * hash.c (rb_hash_equal): returns true if two hashes have same set of key-value set. [ruby-talk:97559] * hash.c (rb_hash_eql): returns true if two hashes are equal and have same default values. * string.c (rb_str_equal): always returns true or false, never returns nil. [ruby-dev:23404] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 9f099cdca..faff5e444 100644 --- a/eval.c +++ b/eval.c @@ -2573,14 +2573,14 @@ svalue_to_mrhs(v, lhs) { VALUE tmp; - if (v == Qundef) return rb_ary_new2(0); + if (v == Qundef) return rb_values_new2(0, 0); tmp = rb_check_array_type(v); if (NIL_P(tmp)) { - return rb_ary_new3(1, v); + return rb_values_new(1, v); } /* no lhs means splat lhs only */ if (!lhs) { - return rb_ary_new3(1, v); + return rb_values_new(1, v); } return tmp; } @@ -2602,8 +2602,11 @@ static VALUE splat_value(v) VALUE v; { - if (NIL_P(v)) return rb_ary_new3(1, Qnil); - return rb_Array(v); + VALUE val; + + if (NIL_P(v)) val = rb_ary_new3(1, Qnil); + else val = rb_Array(v); + return rb_values_from_ary(val); } static VALUE @@ -3569,6 +3572,22 @@ rb_eval(self, n) } break; + case NODE_VALUES: + { + VALUE val; + long i; + + i = node->nd_alen; + val = rb_values_new2(i, 0); + for (i=0;node;node=node->nd_next) { + RARRAY(val)->ptr[i++] = rb_eval(self, node->nd_head); + RARRAY(val)->len = i; + } + + result = val; + } + break; + case NODE_STR: result = rb_str_new3(node->nd_lit); break; -- cgit