summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-09 18:33:52 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-09 18:33:52 +0000
commitdc08e8a60f3ea931598f7d240c76ad3f09ae3cef (patch)
tree5628bd9e80090bdbba957883afa0559d81cce1c7
parentae6b9ced18f366e4ae054f8cc6d1eae3bb8cce9e (diff)
* variable.c (rb_mod_name): search module path if classname is not
set yet. (ruby-bugs-ja PR#424) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--object.c4
-rw-r--r--variable.c6
3 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d445da75da..345115081c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Apr 10 03:22:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_mod_name): search module path if classname is not
+ set yet. (ruby-bugs-ja PR#424)
+
Thu Apr 10 01:52:24 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* eval.c (rb_obj_is_method): indefinite return value.
diff --git a/object.c b/object.c
index ce43886348..afd2e197a7 100644
--- a/object.c
+++ b/object.c
@@ -945,7 +945,7 @@ rb_obj_ivar_get(obj, iv)
ID id = rb_to_id(iv);
if (!rb_is_instance_id(id)) {
- rb_name_error(id, "`%s' is not an instance variable name", rb_id2name(id));
+ rb_name_error(id, "`%s' is not allowed as an instance variable name", rb_id2name(id));
}
return rb_ivar_get(obj, id);
}
@@ -957,7 +957,7 @@ rb_obj_ivar_set(obj, iv, val)
ID id = rb_to_id(iv);
if (!rb_is_instance_id(id)) {
- rb_name_error(id, "`%s' is not an instance variable name", rb_id2name(id));
+ rb_name_error(id, "`%s' is not allowed as an instance variable name", rb_id2name(id));
}
return rb_ivar_set(obj, id, val);
}
diff --git a/variable.c b/variable.c
index 0f5185a5fa..2f35d53116 100644
--- a/variable.c
+++ b/variable.c
@@ -182,7 +182,7 @@ rb_mod_name(mod)
VALUE path = classname(mod);
if (path) return rb_str_dup(path);
- return rb_str_new(0,0);
+ return rb_str_dup(rb_class_path(mod));
}
VALUE
@@ -1112,7 +1112,7 @@ rb_obj_remove_instance_variable(obj, name)
rb_raise(rb_eSecurityError, "Insecure: can't modify instance variable");
if (OBJ_FROZEN(obj)) rb_error_frozen("object");
if (!rb_is_instance_id(id)) {
- rb_name_error(id, "`%s' is not an instance variable", rb_id2name(id));
+ rb_name_error(id, "`%s' is not allowed as an instance variable name", rb_id2name(id));
}
switch (TYPE(obj)) {
@@ -1232,7 +1232,7 @@ rb_mod_remove_const(mod, name)
VALUE val;
if (!rb_is_const_id(id)) {
- rb_name_error(id, "`%s' is not constant", rb_id2name(id));
+ rb_name_error(id, "`%s' is not allowed as a constant name", rb_id2name(id));
}
if (!OBJ_TAINTED(mod) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't remove constant");