diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-18 19:18:15 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-18 19:18:15 +0000 |
commit | 12f4488c582a4f80bfe971754dbf7da7df2cea95 (patch) | |
tree | 003e186a6ef5e9e209b4528adc59262f20fb4324 /proc.c | |
parent | fff67882f9ed1436a32fd9120158d274c4515234 (diff) |
merge revision(s) 40525,40526,40528,40530: [Backport #8345]
proc.c: remove unnecessary static function
* proc.c (proc_lambda): remove and use rb_block_lambda directly
instead.
* include/ruby/intern.h (rb_block_lambda): add declaration instead of
deprecated rb_f_lambda.
* proc.c (mproc, mlambda): use frozen core methods instead of plain
global methods, so that methods cannot be overridden.
[ruby-core:54687] [Bug #8345]
* vm.c (Init_VM): define proc and lambda on the frozen core object.
* defs/id.def (predefined): add "idProc".
* proc.c (mnew, mproc, mlambda): use predefined IDs.
* vm.c (Init_VM): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 30 |
1 files changed, 12 insertions, 18 deletions
@@ -481,6 +481,14 @@ rb_block_proc(void) return proc_new(rb_cProc, FALSE); } +/* + * call-seq: + * lambda { |...| block } -> a_proc + * + * Equivalent to <code>Proc.new</code>, except the resulting Proc objects + * check the number of parameters passed when called. + */ + VALUE rb_block_lambda(void) { @@ -494,20 +502,6 @@ rb_f_lambda(void) return rb_block_lambda(); } -/* - * call-seq: - * lambda { |...| block } -> a_proc - * - * Equivalent to <code>Proc.new</code>, except the resulting Proc objects - * check the number of parameters passed when called. - */ - -static VALUE -proc_lambda(void) -{ - return rb_block_lambda(); -} - /* Document-method: === * * call-seq: @@ -952,7 +946,7 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope) again: me = rb_method_entry_without_refinements(klass, id, &defined_class); if (UNDEFINED_METHOD_ENTRY_P(me)) { - ID rmiss = rb_intern("respond_to_missing?"); + ID rmiss = idRespond_to_missing; VALUE sym = ID2SYM(id); if (obj != Qundef && !rb_method_basic_definition_p(klass, rmiss)) { @@ -1993,13 +1987,13 @@ method_inspect(VALUE method) static VALUE mproc(VALUE method) { - return rb_funcall(Qnil, rb_intern("proc"), 0); + return rb_funcall2(rb_mRubyVMFrozenCore, idProc, 0, 0); } static VALUE mlambda(VALUE method) { - return rb_funcall(Qnil, rb_intern("lambda"), 0); + return rb_funcall(rb_mRubyVMFrozenCore, idLambda, 0, 0); } static VALUE @@ -2339,7 +2333,7 @@ Init_Proc(void) /* utility functions */ rb_define_global_function("proc", rb_block_proc, 0); - rb_define_global_function("lambda", proc_lambda, 0); + rb_define_global_function("lambda", rb_block_lambda, 0); /* Method */ rb_cMethod = rb_define_class("Method", rb_cObject); |