diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-02-27 04:52:21 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-02-27 04:52:21 +0000 |
commit | 3fc04d9361549d5bb15f869c22d7ce9591a0ac8c (patch) | |
tree | b160a4f2ed1605c1a4ef62d6c568ff807fda24c5 /eval.c | |
parent | 2fcd221fecabe3e6acaa21c54ae6d1ccbe8c0204 (diff) |
* ext/dbm/dbm.c (fdbm_select): 1.7 behavior.
* ext/gdbm/gdbm.c (fgdbm_select): ditto.
* ext/sdbm/sdbm.c (fsdbm_select): ditto.
* ext/dbm/dbm.c (fdbm_delete): adopt Hash#delete behavior.
* ext/sdbm/sdbm.c (fsdbm_delete): ditto.
* ext/gdbm/gdbm.c: need not to dup key to the block.
* ext/sdbm/sdbm.c : replace RuntimeError with SDBMError.
* eval.c (rb_f_missing): NoMethod error messages for true, false,
nil must respond visibility like for other objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 47 |
1 files changed, 24 insertions, 23 deletions
@@ -4232,13 +4232,13 @@ rb_f_missing(argc, argv, obj) switch (TYPE(obj)) { case T_NIL: - format = "undefined method `%s' for nil"; + desc = "nil"; break; case T_TRUE: - format = "undefined method `%s' for true"; + desc = "true"; break; case T_FALSE: - format = "undefined method `%s' for false"; + desc = "false"; break; case T_OBJECT: d = rb_any_to_s(obj); @@ -4248,40 +4248,41 @@ rb_f_missing(argc, argv, obj) break; } if (d) { - if (last_call_status & CSTAT_PRIV) { - format = "private method `%s' called for %s%s%s"; - } - if (last_call_status & CSTAT_PROT) { - format = "protected method `%s' called for %s%s%s"; - } - else if (last_call_status & CSTAT_VCALL) { - const char *mname = rb_id2name(id); - - if (('a' <= mname[0] && mname[0] <= 'z') || mname[0] == '_') { - format = "undefined local variable or method `%s' for %s%s%s"; - exc = rb_eNameError; - } - } - if (!format) { - format = "undefined method `%s' for %s%s%s"; - } if (RSTRING(d)->len > 65) { d = rb_any_to_s(obj); } desc = RSTRING(d)->ptr; } + if (last_call_status & CSTAT_PRIV) { + format = "private method `%s' called for %s%s%s"; + } + if (last_call_status & CSTAT_PROT) { + format = "protected method `%s' called for %s%s%s"; + } + else if (last_call_status & CSTAT_VCALL) { + const char *mname = rb_id2name(id); + + if (('a' <= mname[0] && mname[0] <= 'z') || mname[0] == '_') { + format = "undefined local variable or method `%s' for %s%s%s"; + exc = rb_eNameError; + } + } + if (!format) { + format = "undefined method `%s' for %s%s%s"; + } + ruby_sourcefile = file; ruby_sourceline = line; PUSH_FRAME(); /* fake frame */ *ruby_frame = *_frame.prev->prev; - { char buf[BUFSIZ]; + int noclass = (!d || desc[0]=='#'); snprintf(buf, BUFSIZ, format, rb_id2name(id), - desc, desc[0]=='#' ? "" : ":", - desc[0]=='#' ? "" : rb_class2name(CLASS_OF(obj))); + desc, noclass ? "" : ":", + noclass ? "" : rb_class2name(CLASS_OF(obj))); exc = rb_exc_new2(exc, buf); rb_iv_set(exc, "name", argv[0]); rb_iv_set(exc, "args", rb_ary_new4(argc-1, argv+1)); |