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

* 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
This commit is contained in:
matz 2003-07-26 02:26:08 +00:00
parent eb51666a19
commit 34ca2ab058
8 changed files with 18 additions and 38 deletions

View file

@ -19,6 +19,13 @@ Sat Jul 26 01:33:51 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* 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 <matz@ruby-lang.org>
* 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 <nakahiro@sarion.co.jp>
* ext/openssl/sample: Add samples.

View file

@ -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.

10
eval.c
View file

@ -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);

View file

@ -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

View file

@ -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));

View file

@ -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)

View file

@ -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

View file

@ -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 */
}