mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_eval): overriding false constant with class/module
definition should be error. (PR#327) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c7b20263a2
commit
1ec2805c4f
2 changed files with 5 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Sep 5 13:09:22 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* eval.c (rb_eval): overriding false constant with class/module
|
||||
definition should be error. (PR#327)
|
||||
|
||||
Thu Sep 5 01:24:26 2002 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* extmk.rb (create_makefile): add macro MAKEDIRS, INSTALL_PROG,
|
||||
|
|
6
eval.c
6
eval.c
|
@ -3299,14 +3299,11 @@ rb_eval(self, n)
|
|||
super = 0;
|
||||
}
|
||||
|
||||
klass = 0;
|
||||
if ((ruby_class == rb_cObject) && rb_autoload_defined(node->nd_cname)) {
|
||||
rb_autoload_load(node->nd_cname);
|
||||
}
|
||||
if (rb_const_defined_at(ruby_class, node->nd_cname)) {
|
||||
klass = rb_const_get(ruby_class, node->nd_cname);
|
||||
}
|
||||
if (klass) {
|
||||
if (TYPE(klass) != T_CLASS) {
|
||||
rb_raise(rb_eTypeError, "%s is not a class",
|
||||
rb_id2name(node->nd_cname));
|
||||
|
@ -3345,14 +3342,11 @@ rb_eval(self, n)
|
|||
if (NIL_P(ruby_class)) {
|
||||
rb_raise(rb_eTypeError, "no outer class/module");
|
||||
}
|
||||
module = 0;
|
||||
if ((ruby_class == rb_cObject) && rb_autoload_defined(node->nd_cname)) {
|
||||
rb_autoload_load(node->nd_cname);
|
||||
}
|
||||
if (rb_const_defined_at(ruby_class, node->nd_cname)) {
|
||||
module = rb_const_get(ruby_class, node->nd_cname);
|
||||
}
|
||||
if (module) {
|
||||
if (TYPE(module) != T_MODULE) {
|
||||
rb_raise(rb_eTypeError, "%s is not a module",
|
||||
rb_id2name(node->nd_cname));
|
||||
|
|
Loading…
Add table
Reference in a new issue