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

* compile.c (defined_expr): capture exception during defined?

evaluation.  a patch from wanabe <s.wanabe at gmail.com> in
  [ruby-dev:34461].  [ruby-core:16010]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-04-21 02:02:26 +00:00
parent 6a45f0a50e
commit 7243069d29
2 changed files with 17 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Mon Apr 21 11:00:27 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* compile.c (defined_expr): capture exception during defined?
evaluation. a patch from wanabe <s.wanabe at gmail.com> in
[ruby-dev:34461]. [ruby-core:16010]
Mon Apr 21 10:06:26 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c: should include <errno.h> to refer errno.

View file

@ -2421,10 +2421,21 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
ADD_INSNL(ret, nd_line(node), branchunless, lfinish[1]);
}
if (!self) {
LABEL *lstart = NEW_LABEL(nd_line(node));
LABEL *lend = NEW_LABEL(nd_line(node));
VALUE rescue = NEW_CHILD_ISEQVAL(NEW_NIL(),
rb_str_concat(rb_str_new2
("defined guard in "),
iseq->name),
ISEQ_TYPE_DEFINED_GUARD);
defined_expr(iseq, ret, node->nd_recv, lfinish, Qfalse);
ADD_INSNL(ret, nd_line(node), branchunless, lfinish[1]);
ADD_LABEL(ret, lstart);
COMPILE(ret, "defined/recv", node->nd_recv);
ADD_LABEL(ret, lend);
ADD_CATCH_ENTRY(CATCH_TYPE_RESCUE, lstart, lend, rescue, lfinish[1]);
ADD_INSN3(ret, nd_line(node), defined, INT2FIX(DEFINED_METHOD),
ID2SYM(node->nd_mid), needstr);
}