diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-23 07:05:59 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-23 07:05:59 +0000 |
commit | 552fb72159d3bb27ff40ecc121bbc52a3fff89a1 (patch) | |
tree | d6abf2514a01ce6f2ff5160cea2d132933af3973 | |
parent | 44cf56d6e70dbe06a160b004494ba40dd4cfb426 (diff) | |
download | ruby-552fb72159d3bb27ff40ecc121bbc52a3fff89a1.tar.gz |
2000-06-23
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | bignum.c | 9 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | lib/cgi.rb | 20 | ||||
-rw-r--r-- | marshal.c | 2 | ||||
-rw-r--r-- | parse.y | 16 | ||||
-rw-r--r-- | sample/test.rb | 11 | ||||
-rw-r--r-- | string.c | 9 | ||||
-rw-r--r-- | version.h | 4 |
9 files changed, 59 insertions, 25 deletions
@@ -1,3 +1,14 @@ +Fri Jun 23 01:11:27 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * string.c (rb_str_substr): should return empty string (""), + if beg == str.size and len == zero, mostly for convenience and + backward compatibility. + + * parse.y (new_super): should tweak block_pass node for super too. + + * string.c (rb_str_split_m): last split element should not be nil, + but "" when limit is specified. + Thu Jun 22 17:27:46 2000 Yukihiro Matsumoto <matz@netlab.co.jp> * string.c (rb_str_substr): str[n,m] now returns nil when n equals @@ -899,13 +899,8 @@ bigdivmod(x, y, div, mod, modulo) RBIGNUM(*mod)->len = ny; RBIGNUM(*mod)->sign = RBIGNUM(x)->sign; if (modulo && RBIGNUM(x)->sign != RBIGNUM(y)->sign) { - long len = ny; - zds = BDIGITS(*mod); - while (len && !zds[len]) len--; - if (len > 0) { - *mod = bigadd(*mod, y, 1); - return; - } + *mod = bigadd(*mod, y, 1); + return; } *mod = bignorm(*mod); } @@ -4850,7 +4850,7 @@ rb_load(fname, wrap) PUSH_FRAME(); ruby_frame->last_func = 0; ruby_frame->last_class = 0; - ruby_frame->self = ruby_top_self; + ruby_frame->self = self; ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_class,0,0); PUSH_SCOPE(); if (ruby_class == rb_cObject && top_scope->local_tbl) { diff --git a/lib/cgi.rb b/lib/cgi.rb index 4fc2ca71ea..7f40c3a0f6 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -975,7 +975,7 @@ convert string charset, and set language to "ja". '="' + CGI::escapeHTML(value) + '"' end }.to_s + ">" + - if iterator? + if block_given? yield.to_s else "" @@ -1011,7 +1011,7 @@ convert string charset, and set language to "ja". '="' + CGI::escapeHTML(value) + '"' end }.to_s + ">" + - if iterator? + if block_given? yield.to_s + "</element.upcase>" else "" @@ -1036,7 +1036,7 @@ convert string charset, and set language to "ja". else href end - if iterator? + if block_given? super(attributes){ yield } else super(attributes) @@ -1055,7 +1055,7 @@ convert string charset, and set language to "ja". else href end - if iterator? + if block_given? super(attributes){ yield } else super(attributes) @@ -1074,7 +1074,7 @@ convert string charset, and set language to "ja". else cite or "" end - if iterator? + if block_given? super(attributes){ yield } else super(attributes) @@ -1093,7 +1093,7 @@ convert string charset, and set language to "ja". else align or "" end - if iterator? + if block_given? super(attributes){ yield } else super(attributes) @@ -1225,7 +1225,7 @@ convert string charset, and set language to "ja". end method end - if iterator? + if block_given? body = yield else body = "" @@ -1315,7 +1315,7 @@ convert string charset, and set language to "ja". buf.concat( doctype ) end - if iterator? + if block_given? buf.concat( super(attributes){ yield } ) else buf.concat( super(attributes) ) @@ -1397,7 +1397,7 @@ convert string charset, and set language to "ja". end action end - if iterator? + if block_given? form(attributes){ yield } else form(attributes) @@ -1672,7 +1672,7 @@ convert string charset, and set language to "ja". else name end - if iterator? + if block_given? super(attributes){ yield } else super(attributes) @@ -985,7 +985,7 @@ Init_marshal() s_load = rb_intern("_load"); rb_define_module_function(rb_mMarshal, "dump", marshal_dump, -1); rb_define_module_function(rb_mMarshal, "load", marshal_load, -1); - rb_define_module_function(rb_mMarshal, "restore", marshal_load, 1); + rb_define_module_function(rb_mMarshal, "restore", marshal_load, -1); rb_provide("marshal.so"); /* for backward compatibility */ } @@ -83,6 +83,7 @@ static int in_defined = 0; static NODE *arg_blk_pass(); static NODE *new_call(); static NODE *new_fcall(); +static NODE *new_super(); static NODE *gettable(); static NODE *assignable(); @@ -451,7 +452,7 @@ command_call : operation call_args { if (!compile_for_eval && !cur_mid && !in_single) yyerror("super called outside of method"); - $$ = NEW_SUPER($2); + $$ = new_super($2); fixpos($$, $2); } @@ -1390,7 +1391,7 @@ method_call : operation '(' opt_call_args close_paren if (!compile_for_eval && !cur_mid && !in_single && !in_defined) yyerror("super called outside of method"); - $$ = NEW_SUPER($3); + $$ = new_super($3); } | kSUPER { @@ -4387,6 +4388,17 @@ new_fcall(m,a) return NEW_FCALL(m,a); } +static NODE* +new_super(a) + NODE *a; +{ + if (a && nd_type(a) == NODE_BLOCK_PASS) { + a->nd_iter = NEW_SUPER(a->nd_head); + return a; + } + return NEW_SUPER(a); +} + static struct local_vars { ID *tbl; int nofree; diff --git a/sample/test.rb b/sample/test.rb index 8f789fdd88..9da67f5722 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -607,6 +607,17 @@ for i in 4000..4096 end ok($good) +b = 10**80 +a = b * 9 + 7 +ok(7 == a % b) +ok(7-b == a % (-b)) +ok(b-7 == (-a) % b) +ok(-7 ==(-a) % (-b)) +ok(7 ==a.remainder(b)) +ok(7 ==a.remainder(-b)) +ok(-7 == (-a).remainder(b)) +ok(-7 == (-a).remainder(-b)) + check "string & char" ok("abcd" == "abcd") @@ -329,7 +329,8 @@ rb_str_substr(str, beg, len) VALUE str2; if (len < 0) return Qnil; - if (beg >= RSTRING(str)->len) return Qnil; + if (beg > RSTRING(str)->len) return Qnil; + if (beg == RSTRING(str)->len && len > 0) return Qnil; if (beg < 0) { beg += RSTRING(str)->len; if (beg < 0) return Qnil; @@ -2226,7 +2227,11 @@ rb_str_split_m(argc, argv, str) } } if (!NIL_P(limit) || RSTRING(str)->len > beg || lim < 0) { - rb_ary_push(result, rb_str_substr(str, beg, RSTRING(str)->len-beg)); + if (RSTRING(str)->len == beg) + tmp = rb_str_new(0, 0); + else + tmp = rb_str_substr(str, beg, RSTRING(str)->len-beg); + rb_ary_push(result, tmp); } if (NIL_P(limit) && lim == 0) { while (RARRAY(result)->len > 0 && @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.5.4" -#define RUBY_RELEASE_DATE "2000-06-22" +#define RUBY_RELEASE_DATE "2000-06-23" #define RUBY_VERSION_CODE 154 -#define RUBY_RELEASE_CODE 20000622 +#define RUBY_RELEASE_CODE 20000623 |