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

* variable.c (rb_obj_remove_instance_variable): raise NameError if

specified instance variable is not defined.

* variable.c (generic_ivar_remove): modified to check ivar
  existence.

* class.c (rb_singleton_class): wrong condition; was creating
  unnecessary singleton class.

* numeric.c (int_step): step may be a float less than 1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-04-10 08:47:46 +00:00
parent 34159dac1c
commit daadb8bd53
9 changed files with 50 additions and 25 deletions

View file

@ -1,12 +1,30 @@
<<<<<<< ChangeLog
Wed Apr 10 17:30:19 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (rb_obj_remove_instance_variable): raise NameError if
specified instance variable is not defined.
* variable.c (generic_ivar_remove): modified to check ivar
existence.
Wed Apr 10 14:16:45 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* misc/ruby-mode.el (ruby-font-lock-keywords): fontify symbols for
unary operators and aset.
Sat Apr 6 02:04:49 2002 Guy Decoux <ts@moulon.inra.fr>
* class.c (rb_singleton_class): wrong condition; was creating
unnecessary singleton class.
Thu Apr 4 15:45:12 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* parse.y: avoid bison 1.34 warnings. add `;' at the end of a rule.
Thu Apr 4 01:08:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* numeric.c (int_step): step may be a float less than 1.
Wed Apr 3 01:54:10 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* ext/extmk.rb.in (enable_config): follow lib/mkmf.rb.

View file

@ -13,7 +13,7 @@ AUTOCONF = autoconf
prefix = @prefix@
CFLAGS = @CFLAGS@
CPPFLAGS = -I. -I$(srcdir) -I@includedir@
CPPFLAGS = -I. -I$(srcdir)
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
XLDFLAGS = @XLDFLAGS@
EXTLIBS =

View file

@ -626,7 +626,9 @@ rb_singleton_class(obj)
}
DEFER_INTS;
if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON)) {
if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) &&
((BUILTIN_TYPE(obj) != T_CLASS && BUILTIN_TYPE(obj) != T_MODULE) ||
rb_iv_get(RBASIC(obj)->klass, "__attached__") == obj)) {
klass = RBASIC(obj)->klass;
}
else {

View file

@ -75,8 +75,8 @@ if /mswin32/ =~ RUBY_PLATFORM
else
OUTFLAG = '-o '
end
LINK = "@CC@ #{OUTFLAG}conftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir @LDFLAGS@ %s %s %s conftest.c %s %s @LIBS@"
CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir %s %s %s conftest.c"
LINK = "@CC@ #{OUTFLAG}conftest -I#$topdir -I#$top_srcdir #{CFLAGS} @LDFLAGS@ %s %s %s conftest.c %s %s @LIBS@"
CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} %s %s %s conftest.c"
$log = open('extmk.log', 'w')
@ -416,7 +416,7 @@ hdrdir = #{$top_srcdir}
CC = @CC@
CFLAGS = %s #{CFLAGS} #$CFLAGS
CPPFLAGS = -I$(topdir) -I$(hdrdir) -I@includedir@ %s #$CPPFLAGS
CPPFLAGS = -I$(topdir) -I$(hdrdir) %s #$CPPFLAGS
DLDFLAGS = #$DLDFLAGS #$LDFLAGS
LDSHARED = @LDSHARED@ #{defflag}
", if $static then "" else "@CCDLFLAGS@" end, $defs.join(" ")

View file

@ -134,6 +134,7 @@ class CGI
end
def update
return unless @hash
@f.rewind
for k,v in @hash
@f.printf "%s=%s\n", CGI::escape(k), CGI::escape(v)

View file

@ -64,8 +64,8 @@ if /mswin32/ =~ RUBY_PLATFORM
else
OUTFLAG = '-o '
end
LINK = "#{CONFIG['CC']} #{OUTFLAG}conftest -I#{$hdrdir} #{CFLAGS} -I#{CONFIG['includedir']} %s %s #{CONFIG['LDFLAGS']} %s conftest.c %s %s #{CONFIG['LIBS']}"
CPP = "#{CONFIG['CPP']} -E %s -I#{$hdrdir} #{CFLAGS} -I#{CONFIG['includedir']} %s %s conftest.c"
LINK = "#{CONFIG['CC']} #{OUTFLAG}conftest -I#{$hdrdir} #{CFLAGS} %s %s #{CONFIG['LDFLAGS']} %s conftest.c %s %s #{CONFIG['LIBS']}"
CPP = "#{CONFIG['CPP']} -E %s -I#{$hdrdir} #{CFLAGS} %s %s conftest.c"
def rm_f(*files)
targets = []
@ -454,7 +454,7 @@ VPATH = $(srcdir)
CC = #{CONFIG["CC"]}
CFLAGS = #{CONFIG["CCDLFLAGS"]} #{CFLAGS} #{$CFLAGS}
CPPFLAGS = -I. -I$(hdrdir) -I$(srcdir) -I#{CONFIG["includedir"]} #{$defs.join(" ")} #{CONFIG["CPPFLAGS"]} #{$CPPFLAGS}
CPPFLAGS = -I. -I$(hdrdir) -I$(srcdir) #{$defs.join(" ")} #{CONFIG["CPPFLAGS"]} #{$CPPFLAGS}
CXXFLAGS = $(CFLAGS)
DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS}
LDSHARED = #{CONFIG["LDSHARED"]} #{defflag}

View file

@ -1411,7 +1411,7 @@ int_step(from, to, step)
VALUE i = from;
ID cmp;
if (NUM2INT(step) == 0) {
if (rb_equal(step, INT2FIX(0))) {
rb_raise(rb_eArgError, "step cannot be 0");
}

View file

@ -254,8 +254,7 @@ rb_autoload_id(id, filename)
{
rb_secure(4);
if (!rb_is_const_id(id)) {
rb_raise(rb_eNameError, "autoload must be constant name",
rb_id2name(id));
rb_raise(rb_eNameError, "autoload must be constant name");
}
if (!autoload_tbl) {
@ -812,22 +811,23 @@ generic_ivar_defined(obj, id)
return Qfalse;
}
static VALUE
generic_ivar_remove(obj, id)
static int
generic_ivar_remove(obj, id, valp)
VALUE obj;
ID id;
VALUE *valp;
{
st_table *tbl;
VALUE val;
int status;
if (!generic_iv_tbl) return Qnil;
if (!st_lookup(generic_iv_tbl, obj, &tbl)) return Qnil;
st_delete(tbl, &id, &val);
if (!generic_iv_tbl) return 0;
if (!st_lookup(generic_iv_tbl, obj, &tbl)) return 0;
status = st_delete(tbl, &id, valp);
if (tbl->num_entries == 0) {
st_delete(generic_iv_tbl, &obj, &tbl);
st_free_table(tbl);
}
return val;
return status;
}
void
@ -1020,16 +1020,20 @@ rb_obj_remove_instance_variable(obj, name)
case T_OBJECT:
case T_CLASS:
case T_MODULE:
if (ROBJECT(obj)->iv_tbl) {
st_delete(ROBJECT(obj)->iv_tbl, &id, &val);
if (ROBJECT(obj)->iv_tbl && st_delete(ROBJECT(obj)->iv_tbl, &id, &val)) {
return val;
}
break;
default:
if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj))
return generic_ivar_remove(obj, id);
if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj)) {
if (generic_ivar_remove(obj, id, &val)) {
return val;
}
}
break;
}
return val;
rb_raise(rb_eNameError, "instance variable %s not defined", rb_id2name(id));
return Qnil; /* not reached */
}
static int

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.7"
#define RUBY_RELEASE_DATE "2002-04-04"
#define RUBY_RELEASE_DATE "2002-04-10"
#define RUBY_VERSION_CODE 167
#define RUBY_RELEASE_CODE 20020404
#define RUBY_RELEASE_CODE 20020410