arguement type mismatch, and inline method_list().
[ruby-core:01198]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
check (and warning) into one function; following DRY principle.
[ruby-core:01193]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-dev:20360]
* eval.c (rb_eval): support new_yield() change.
* variable.c (rb_const_get_0): warn for Foo::BAR when BAR is a
toplevel constant (i.e. a constant defined under Object).
[ruby-list:36935]
* parse.y (no_blockarg): separate no block argument check and
ret_args argument processing.
* range.c (rb_range_beg_len): out_of_range check after adjusting
end point. [ruby-dev:20370]
* parse.y (call_args): the first argument to arg_cancat() should
be NODE_LIST. [ruby-core:01151]
* eval.c (rb_eval): should dispatch based on ID type.
* eval.c (rb_yield_0): should restore scope_vmode during yield.
[ruby-dev:20361]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (rb_hash_values_at,env_values_at): ditto.
* re.c (match_values_at): ditto.
* struct.c (rb_struct_values_at): ditto.
* re.c (match_select): add iterator behavior.
* ext/curses/curses.c, ext/digest/sha2/sha2.c, ext/iconv/iconv.c,
ext/racc/cparse/cparse.c: include "ruby.h" at the top to shut up
"_FILE_OFFSET_BITS redefined" warning on Solaris.
* class.c (rb_class_protected_instance_methods): now gives
warnings to show migration path. The default will be reversed
on Jan 2004.
* numeric.c (num_step): "1.1.step(1.5,0.1)" to work.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
warnings to show migration path.
* lib/delegate.rb (Delegator::initialize): instance_methods
etc. now recurse by default. need to specify false.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (env_shift): ditto.
* hash.c (env_invert): ditto.
* hash.c (env_replace): ditto.
* hash.c (env_update): ditto.
* array.c (rb_ary_join): dispatch based on "to_str".
* array.c (rb_ary_times): ditto.
* array.c (rb_ary_equal): ditto.
* process.c (rb_f_exec): dispatch based on "to_ary".
* eval.c (umethod_bind): exact class match is not required. relax
the restriction to subclasses.
* eval.c (rb_eval): call "inherited" before executing class body.
* class.c (rb_define_class): call "inherited" after defining the
constant.
* class.c (rb_define_class_under): ditto.
* eval.c (massign): expand first element if RHS is an array and
its size is 1, and LHS has concrete assignment target (i.e. LHS
has target(s) other than *var).
* eval.c (massign): avoid unnecessary avalue/svalue conversion.
* eval.c (rb_yield_0): ditto
* array.c (rb_ary_update): do not allocate unused array if rpl is
nil (i.e. merely removing elements).
* io.c (io_read): should resize supplied string if it's shorter
than expected.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
st_compare_func_t, st_hash_func_t and st_each_func_t.
* st.h, st.c: Do explicit function declarations and do not rely on
implicit declarations. On such platforms as IA64, int argument
values are NOT automatically promoted to long (64bit) values, so
explicit declarations are mandatory for those functions that
take long values or pointers. This fixes miniruby's coredump on
FreeBSD/IA64.
* class.c, eval.c, gc.c, hash.c, marshal.c, parse.y, variable.c:
Add proper casts to avoid warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_check_array_type): new function: return an array
(convert if possible), or nil.
* string.c (rb_check_string_type): new function: return a string
(convert if possible), or nil.
* numeric.c (rb_dbl_cmp): returns nil if values are not
comparable.
* numeric.c (fix_cmp,flo_cmp): use rb_num_coerce_cmp()
* bignum.c (rb_big_cmp): ditto.
* numeric.c (rb_num_coerce_cmp): new coercing function for "<=>",
which does not raise TypeError.
* numeric.c (do_coerce): can be supress exception now.
* object.c (rb_mod_cmp): should return nil for non class/module
objects.
* re.c (rb_reg_eqq): return false if the argument is not a
string. now returns boolean value.
* class.c (rb_include_module): argument should be T_MODULE, not
T_class, nor T_ICLASS.
* eval.c (is_defined): "defined?" should return "assignment" for
attribute assignment (e.g. a.foo=b) and indexed assignment
(e.g. a[2] = 44).
* parse.y (aryset): use NODE_ATTRASGN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
really a module, whose methods must be safe for reciever's type.
* eval.c (rb_eval): nosuper should not be inherited unless the
overwritten method is an undef placeholder.
* parse.y (primary): allow 'when'-less case statement; persuaded
by Sean Chittenden.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
public_method_defined?, private_method_defined?,
protected_method_defined?
* object.c (rb_obj_public_methods): new method
Object#public_methods.
* class.c (ins_methods_i): Object#methods should list both public
and protected methods.
* class.c (rb_class_public_instance_methods): new method
Module#public_instance_methods.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
self-assignment.
* class.c (rb_make_metaclass): metaclass of a superclass may be
NULL at boot time.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c (ruby_run): should set toplevel visibility again here.
* eval.c (rb_eval): should not rely on ruby_class == rb_cObject
check. Besides allow implicit publicity for attribute set
methods.
* parse.y (primary): need not to check class_nest, just set
whether method is an attrset or not.
* string.c (rb_str_each_line): p might be at the top of the
string.
* class.c (rb_make_metaclass): class of metaclass should be
metaclass of superclass, unless class itself is a metaclass;
class of metaclass of metaclass should point back to self.
eh, confusing, isn't it.
* class.c (rb_singleton_class): check if its class is singleton
AND attached to self.
* eval.c (rb_eval): should define class/module under ruby_cbase.
* eval.c (rb_eval): should set class/module path based on
ruby_cbase, not ruby_class.
* eval.c (module_setup): use ruby_cbase instead of ruby_class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c (w_extended): should allow marshaling of object which
is extended by named module.
* class.c (rb_make_metaclass): super may be T_ICLASS, need to skip.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to obj.meta.meta.super (ruby-bugs-ja:PR#324).
* parse.y (yylex): the warning message "invalid
character syntax" was never issued.
* marshal.c (r_bytes): do not use alloca (ruby-bugs:PR#382).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
variable table if it existes.
* class.c (rb_make_metaclass): metaclass of a metaclass is a
metaclass itself.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c (rb_find_file_ext): ditto.
* range.c (range_eq): class check should be based on range.class,
instead of Range to work with Range.dup.
* range.c (range_eql): ditto.
* class.c (rb_mod_dup): need to preserve metaclass and flags.
* object.c (rb_cstr_to_dbl): had a buffer overrun.
* marshal.c (w_class): integrate singleton check into a funciton
to follow DRY principle.
* marshal.c (w_uclass): should check singleton method.
* object.c (rb_obj_dup): dmark and dfree functions must be match
for T_DATA type.
* object.c (rb_obj_dup): class of the duped object must be match
to the class of the original.
* re.c (rb_reg_quote): do not escape \t, \f, \r, \n, for they are
not regular expression metacharacters.
* time.c (time_s_alloc): use time_free instead of free (null check,
also serves for type mark).
* time.c (time_s_at): check dfree function too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
substring, slice! should return nil without exception.
* array.c (rb_ary_insert): type fixed.
* string.c (rb_str_split_m): accept separator value nil as well.
* string.c (rb_str_become): was leaking memory.
* class.c (rb_include_module): should not alter other
classes/modules by inclusion. by this fix, local order may not
be preserved for some cases.
* class.c (include_class_new): module may be T_ICLASS; retrieve
original module information.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
singleton cbase.
* eval.c (is_defined): adopt new cvar behavior.
* eval.c (rb_eval): ditto.
* eval.c (assign): ditto.
* class.c (rb_mod_clone): should not call rb_obj_clone(), since
Module does not provide "allocate".
* class.c (rb_singleton_class): should crate new singleton class
if obj is a class or module and attached object is different,
which means metaclass of singleton class is sought.
* time.c (time_s_alloc): now follows allocation framework.
* eval.c (rb_eval): should initialize outer class variables from
methods in singleton class definitions.
* eval.c (assign): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
directories.
* class.c (rb_include_module): should preserve ancestor order in
the included class/module.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c (rb_thread_cleanup): need not to free thread stacks at
process termination.
* array.c (rb_ary_fetch): use the block to get the default value
if the block is given.
* eval.c (rb_thread_schedule): should check time only if BOTH
WAIT_SELECT and WAIT_TIME.
* eval.c (umethod_bind): should update rklass field.
* hash.c (rb_hash_update): if a block is given, yields [key,
value1, value2] to the block to resolve conflict.
* string.c (rb_str_split_m): no need to consider KANJI
characters, if the length of separator is 1 (byte).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c (rb_cstr2inum): reject prefix followed by spaces only.
* class.c (rb_class_inherited): should use Object when no super
class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (rb_hash_set_default): Hash#default= should return the
new value.
* string.c (rb_str_to_i): accepts optional base argument. [new]
* numeric.c (rb_fix2str): should not handle negative fixnum values
int32 via calling sprintf() directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c (rb_thread_schedule): should not select a thread which is
not yet initialized.
* time.c (time_plus): wrong boundary check.
* time.c (time_minus): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
modifying buffer is shared.
* array.c (ary_make_shared): make an internal buffer of an array
to be shared.
* array.c (rb_ary_shift): avoid sliding an internal buffer by
using shared buffer.
* array.c (rb_ary_subseq): avoid copying the buffer.
* parse.y (gettable): should freeze __LINE__ string.
* io.c (rb_io_puts): old behavoir restored. rationale: a) if you
want to call to_s for arrays, you can just call print a, "\n".
b) to_s wastes memory if array (and sum of its contents) is
huge. c) now any object that has to_ary is treated as an array,
using rb_check_convert_type().
* hash.c (rb_hash_initialize): now accepts a block to calculate
the default value. [new]
* hash.c (rb_hash_aref): call "default" method to get the value
corrensponding to the non existing key.
* hash.c (rb_hash_default): get the default value based on the
block given to 'new'. Now it takes an optinal "key" argument.
"default" became the method to get the value for non existing
key. Users may override "default" method to change the hash
behavior.
* hash.c (rb_hash_set_default): clear the flag if a block is given
to 'new'
* object.c (Init_Object): undef Data.allocate, left Data.new.
* ext/curses/curses.c (window_scrollok): use RTEST().
* ext/curses/curses.c (window_idlok): ditto.
* ext/curses/curses.c (window_keypad): ditto.
* ext/curses/curses.c (window_idlok): idlok() may return void on
some platforms; so don't use return value.
* ext/curses/curses.c (window_scrollok): ditto for consistency.
* ext/curses/curses.c: replace FIX2INT() by typechecking NUM2INT().
* parse.y (str_extend): should not process immature #$x and
#@x interpolation, e.g #@#@ etc.
* enum.c (enum_sort_by): sort_by does not have to be stable always.
* enum.c (enum_sort_by): call qsort directly to gain performance.
* util.c (ruby_qsort): ruby_qsort(qs6) is now native thread safe.
* error.c (rb_sys_fail): it must be a bug if it's called when
errno == 0.
* regex.c (WC2MBC1ST): should not pass through > 0x80 number in UTF-8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
expression interpolation.
* pack.c (pack_unpack): should give length to utf8_to_uv().
* pack.c (utf8_to_uv): add length check.
* massages: replace "wrong #" by "wrong number".
* marshal.c (w_float): output Infinity and NaN explicitly.
* marshal.c (r_object): support new explicit float format.
* eval.c (rb_thread_wait_for): select may cause ERESTART on
Solaris.
* eval.c (rb_thread_select): ditto.
* array.c (rb_ary_join): dumped core if sep is not T_STRING nor T_NIL.
* array.c (rb_ary_join): buffer size calculattion was wrong.
* array.c (rb_ary_to_s): if rb_output_fs is nil, insert newlines
between array elements (use rb_default_rs as newline litral)
[experimental].
* gc.c (init_mark_stack): no need to clear mark_stack.
* gc.c (gc_mark_all): need to handle finalizer mark.
* gc.c (gc_mark_rest): use MEMCPY instead of memcpy.
* gc.c (rb_gc_mark): earlier const check to avoid pusing special
constants into mark stack.
* numeric.c (fix_to_s): 'to_s' now takes optional argument to
specify radix. [new]
* bignum.c (rb_big_to_s): ditto. [new]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
should remain anonymous.
* eval.c (rb_call0): self in a block given to define_method now be
switched to the receiver of the method.
* eval.c (proc_invoke): added new parameter to allow self
switching.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
lastline and lastmatch in the thread struct for later restore.
* eval.c (rb_thread_save_context): restore lastline and lastmatch.
* numeric.c (flo_to_s): should handle negative float value.
* class.c (rb_include_module): should check whole ancestors to
avoid duplicate module inclusion.
* string.c (trnext): should check backslash before updating "now"
position.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e