* vm.c (rb_vm_env_local_variables): returns array of local
variable name symbols in the environment by envval.
* proc.c (bind_local_variables): use rb_vm_env_local_variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (bind_receiver): new method to return the bound receiver
of the binding object. [ruby-dev:47613] [Feature #8779]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c (setup_exception): set backtrace in system stack error
other than the pre-allocated sysstack_error. [Feature #6216]
* proc.c (Init_Proc): freeze the pre-allocated sysstack_error.
* vm_insnhelper.c (vm_stackoverflow): raise new instance for each
times without calling any methods to keep the backtrace with no
further stack overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (umethod_bind): use the ancestor iclass instead of new
iclass to get rid of infinite recursion, if the defined module
is already included. [ruby-core:62014] [Bug #9721]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (sym_to_proc), proc.c (rb_block_clear_env_self): clear
caller's self which is useless, so that it can get collected.
[Fixes GH-592]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
add links to `Object#hash` to each #`hash` methods rdocs.
[Fixes GH-567]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (rb_iseq_min_max_arity): maximum argument is unlimited if
having rest keywords argument. [ruby-core:53298] [Bug #8072]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (bind_local_variables): allowing binding to list its
local variables. patch by Jack Danger Canty <jackdanger AT
squareup.com> at [ruby-core:56543]. [Feature #8773]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c (rb_vm_cref_in_context): check also cbase, not only self.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (rb_mod_define_method): consider visibility only if self
in the caller is same as the receiver, otherwise make public as
well as old behavior. [ruby-core:57747] [Bug #9005]
[ruby-core:58497] [Bug #9141]
* vm.c (rb_vm_cref_in_context): return ruby level cref if self is
same.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (mnew_from_me): method by respond_to_missing? should be
owned by the original class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (mnew_from_me): achieve the original defined_class from
prepended iclass, to fix inherited owner.
* proc.c (method_owner): return the defined class, but not the
class which the method object is created from.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (method_owner): return the class where alias is defined, not
the class original method is defined.
* vm_method.c (rb_method_entry_make, rb_alias): store the originally
defined class in me. [Bug #7993] [Bug #7842] [Bug #9236]
* vm_method.c (rb_method_entry_get_without_cache): cache included
module but not iclass.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (method_inspect): use a local variable instead of repeating
dereferences.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Type of return value of rb_iseq_first_lineno() is now VALUE.
* vm_insnhelper.c (argument_error): ditto.
* vm_method.c (rb_method_entry_make): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* VALUE rb_iseq_path(VALUE iseqval);
* VALUE rb_iseq_absolute_path(VALUE iseqval);
* VALUE rb_iseq_label(VALUE iseqval);
* VALUE rb_iseq_base_label(VALUE iseqval);
* VALUE rb_iseq_first_lineno(VALUE iseqval);
And new (temporary) function:
* VALUE rb_iseq_klass(VALUE iseqval);
* iseq.c. vm_core.h (int rb_iseq_first_lineno): remove
function `int rb_iseq_first_lineno(const rb_iseq_t *iseq)'.
Use `VALUE rb_iseq_first_lineno(VALUE iseqval)' instead.
* proc.c. vm_insnhelper.c, vm_method.c: catch up this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and
usecase of this macro is not acquire raw pointer, but acquire
read-only pointer. So we rename to better name.
RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR()
(I expect that nobody use it).
* array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c,
string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c:
catch up this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (mnew_from_me): allocate structs after allocated wrapper
object successfully, to get rid of potential memory leak.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
defined methods, not the methods/procs themselves.
[ruby-dev:42151] [Feature #3753]
* NEWS: documents about above change and def-expr (see r42337).
* test/ruby/test_module.rb: tests about above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to access local variables which a binding contains.
Most part of implementation by nobu.
* test/ruby/test_proc.rb: add a tests for above.
* vm.c, vm_core.h (rb_binding_add_dynavars): add a new function
to add a new environment to create space for new local variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RARRAY_PTR() because there is no new reference.
* proc.c (curry): ditto.
* proc.c (rb_proc_call): remove line break.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
parameter `slot'. You don't need to write a cast (VALUE *) any more.
* class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c,
vm.c, vm_method.c: remove cast expressions for OBJ_WRITE().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_data_type_struct::flags. Now, this flags is passed
at T_DATA object creation. You can specify FL_WB_PROTECTED
on this flag.
* iseq.c: making non-shady iseq objects.
* class.c, compile.c, proc.c, vm.c: add WB for iseq objects.
* vm_core.h, iseq.h: constify fields to detect WB insertion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
new function to invoke a Method object with a block passed
as an argument.
* proc.c (bmcall): use the above function to avoid a block sharing.
[ruby-core:54626] [Bug #8341]
* test/ruby/test_proc.rb (TestProc#test_block_persist_between_calls):
run related tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e