summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-03 09:00:52 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-03 09:00:52 +0000
commit01e181146a3a1b0f0dcf6bf5cf59741b3d2e1566 (patch)
treeb169cc7c3b4f2dd17e6a0d768ba75e1a982632bd
parentc5f07b3cbce4519049b3129878e379404a3492e8 (diff)
* struct.c (make_struct): remove redefining constant when
conflict. [ruby-dev:24210] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--bignum.c8
-rw-r--r--eval.c34
-rw-r--r--struct.c4
4 files changed, 16 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index b786ed8..980efce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Sep 3 17:47:58 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * struct.c (make_struct): remove redefining constant when
+ conflict. [ruby-dev:24210]
+
Fri Sep 3 11:31:44 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: Tk.after makes TkCore::INTERP.tk_cmd_tbl grow
diff --git a/bignum.c b/bignum.c
index d674e68..0622841 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1736,15 +1736,17 @@ rb_big_or(xx, yy)
*/
VALUE
-rb_big_xor(x, y)
- VALUE x, y;
+rb_big_xor(xx, yy)
+ VALUE xx, yy;
{
+ volatile VALUE x, y;
VALUE z;
BDIGIT *ds1, *ds2, *zds;
long i, l1, l2;
char sign;
- y = rb_to_int(y);
+ x = xx;
+ y = rb_to_int(yy);
if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
}
diff --git a/eval.c b/eval.c
index 541ea85..e1599fe 100644
--- a/eval.c
+++ b/eval.c
@@ -1715,37 +1715,6 @@ rb_eval_cmd(cmd, arg, level)
return val;
}
-static VALUE
-superclass(self, node)
- VALUE self;
- NODE *node;
-{
- VALUE val = Qnil; /* OK */
- int state;
-
- PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
- val = rb_eval(self, node);
- }
- POP_TAG();
- if (state) {
- switch (nd_type(node)) {
- case NODE_COLON2:
- rb_raise(rb_eTypeError, "undefined superclass `%s'",
- rb_id2name(node->nd_mid));
- case NODE_CONST:
- rb_raise(rb_eTypeError, "undefined superclass `%s'",
- rb_id2name(node->nd_vid));
- default:
- break;
- }
- JUMP_TAG(state);
- }
- rb_check_inheritable(val);
-
- return val;
-}
-
#define ruby_cbase (ruby_cref->nd_clss)
static VALUE
@@ -3792,7 +3761,8 @@ rb_eval(self, n)
rb_raise(rb_eTypeError, "no outer class/module");
}
if (node->nd_super) {
- super = superclass(self, node->nd_super);
+ super = rb_eval(self, node->nd_super);
+ rb_check_inheritable(super);
}
else {
super = 0;
diff --git a/struct.c b/struct.c
index 900f8bd..4fab88f 100644
--- a/struct.c
+++ b/struct.c
@@ -177,6 +177,10 @@ make_struct(name, member, klass)
if (!rb_is_const_id(id)) {
rb_name_error(id, "identifier %s needs to be constant", cname);
}
+ if (rb_const_defined_at(klass, id)) {
+ rb_warn("redefining constant Struct::%s", cname);
+ rb_mod_remove_const(klass, ID2SYM(id));
+ }
nstr = rb_define_class_under(klass, cname, klass);
}
rb_iv_set(nstr, "__size__", LONG2NUM(RARRAY(member)->len));