From 34ca2ab05891c41e28deecde6a8548127f286525 Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 26 Jul 2003 02:26:08 +0000 Subject: [PATCH] * variable.c (rb_mod_const_missing): "const_missing" should not appear in the caller(); add call frame adjustment. * eval.c (rb_method_missing): simplify call frame adjustment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ doc/NEWS | 25 ------------------------- eval.c | 10 ++++------ ext/tk/lib/tk.rb | 4 ---- intern.h | 2 +- lib/cgi.rb | 3 +++ lib/irb/context.rb | 4 ++-- variable.c | 1 + 8 files changed, 18 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9866883bc..24a2d3382e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,13 @@ Sat Jul 26 01:33:51 2003 NAKAMURA Usaku * ext/openssl/ossl_ssl.c (ossl_ssl_setup): need to pass the real socket to SSL_get_fd on native win32 platforms. +Sat Jul 26 01:20:29 2003 Yukihiro Matsumoto + + * variable.c (rb_mod_const_missing): "const_missing" should not + appear in the caller(); add call frame adjustment. + + * eval.c (rb_method_missing): simplify call frame adjustment. + Fri Jul 26 00:04:25 2003 NAKAMURA, Hiroshi * ext/openssl/sample: Add samples. diff --git a/doc/NEWS b/doc/NEWS index 905d2441c2..b0aa66bd5d 100644 --- a/doc/NEWS +++ b/doc/NEWS @@ -381,20 +381,6 @@ This file is not actively maintained. See ChangeLog for recent changes. Fixed with loading modules. -: MatchData#to_ary - - Added for convenience of Regexp#match. [ruby-dev:12766] - - Previously we had to do: - - foo, bar, baz = /(\w+?)\s+(\w+?)\s+(\w+)/.match("foo bar baz").to_a[1..-1] - p [foo, bar, baz] - - But now can do: - - _, foo, bar, baz = /(\w+?)\s+(\w+?)\s+(\w+)/.match("foo bar baz") - p [foo, bar, baz] - : Math.acos(x) : Math.asin(x) : Math.atan(x) @@ -456,11 +442,6 @@ This file is not actively maintained. See ChangeLog for recent changes. Added. -: Proc#yield - - Added. This is equivalent to Proc#call except it does not check the - number of given arguments, which are thus passed to the proc as-is. - : Process.times Moved from Time.times. (Time.times still remains but emits a @@ -478,12 +459,6 @@ This file is not actively maintained. See ChangeLog for recent changes. Added. -: Range#to_ary - - Added. You can now do something like this: - - a, b, c = 1..3 - : Regexp#options Added. diff --git a/eval.c b/eval.c index 4d0d57c785..cf32ff20d7 100644 --- a/eval.c +++ b/eval.c @@ -4635,7 +4635,7 @@ static int last_call_status; #define CSTAT_SUPER 8 static VALUE -rb_f_missing(argc, argv, obj) +rb_method_missing(argc, argv, obj) int argc; VALUE *argv; VALUE obj; @@ -4697,8 +4697,6 @@ rb_f_missing(argc, argv, obj) } ruby_current_node = cnode; - PUSH_FRAME(); /* fake frame */ - *ruby_frame = *_frame.prev->prev; { char buf[BUFSIZ]; int noclass = (!desc || desc[0]=='#'); @@ -4714,9 +4712,9 @@ rb_f_missing(argc, argv, obj) args[n++] = rb_ary_new4(argc-1, argv+1); } exc = rb_class_new_instance(n, args, exc); + ruby_frame = ruby_frame->prev; /* pop frame for "method_missing" */ rb_exc_raise(exc); } - POP_FRAME(); return Qnil; /* not reached */ } @@ -4735,7 +4733,7 @@ method_missing(obj, id, argc, argv, call_status) if (id == missing) { PUSH_FRAME(); - rb_f_missing(argc, argv, obj); + rb_method_missing(argc, argv, obj); POP_FRAME(); } else if (id == ID_ALLOCATOR) { @@ -6523,7 +6521,7 @@ Init_eval() rb_define_global_function("eval", rb_f_eval, -1); rb_define_global_function("iterator?", rb_f_block_given_p, 0); rb_define_global_function("block_given?", rb_f_block_given_p, 0); - rb_define_global_function("method_missing", rb_f_missing, -1); + rb_define_global_function("method_missing", rb_method_missing, -1); rb_define_global_function("loop", rb_f_loop, 0); rb_define_method(rb_mKernel, "respond_to?", rb_obj_respond_to, -1); diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index b84b0a7c48..d33f5d7d7d 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -956,10 +956,6 @@ module TkCore tk_call 'tk_getSaveFile', *hash_kv(keys) end - def chooseDirectory(keys = nil) - tk_call 'tk_chooseDirectory', *hash_kv(keys) - end - def chooseColor(keys = nil) tk_call 'tk_chooseColor', *hash_kv(keys) end diff --git a/intern.h b/intern.h index 2d6fe50f18..7422a94b45 100644 --- a/intern.h +++ b/intern.h @@ -331,7 +331,7 @@ VALUE rb_f_exec _((int,VALUE*)); int rb_waitpid _((int,int*,int)); void rb_syswait _((int)); VALUE rb_proc_times _((VALUE)); -VALUE rb_proc_detach _((int)); +VALUE rb_detach_process _((int)); /* range.c */ VALUE rb_range_new _((VALUE, VALUE, int)); VALUE rb_range_beg_len _((VALUE, long*, long*, long, int)); diff --git a/lib/cgi.rb b/lib/cgi.rb index 1327b64d34..705b0ccf13 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -959,6 +959,9 @@ convert string charset, and set language to "ja". def to_a @params end + def to_ary # to be rhs of multiple assignment + @params + end end def [](key) diff --git a/lib/irb/context.rb b/lib/irb/context.rb index f1194f8db9..f4d0d98289 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -58,8 +58,8 @@ module IRB case input_method when nil - if (use_readline.nil? && IRB.conf[:PROMPT_MODE] != :INF_RUBY && STDIN.tty? || - use_readline?) + if (defined? (ReadlineInputMethod) && + (use_readline? || IRB.conf[:PROMPT_MODE] != :INF_RUBY && STDIN.tty?)) @io = ReadlineInputMethod.new else @io = StdioInputMethod.new diff --git a/variable.c b/variable.c index 4455d04ece..fd7ff22294 100644 --- a/variable.c +++ b/variable.c @@ -1128,6 +1128,7 @@ VALUE rb_mod_const_missing(klass, name) VALUE klass, name; { + ruby_frame = ruby_frame->prev; /* pop frame for "const_missing" */ uninitialized_constant(klass, rb_to_id(name)); return Qnil; /* not reached */ }