mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* compile.c (defined_expr): default defined? should return
"expression" without evaluating the expression. [ruby-dev:35967] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bc3c178509
commit
9839d737c2
2 changed files with 6 additions and 27 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Aug 25 23:01:17 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* compile.c (defined_expr): default defined? should return
|
||||||
|
"expression" without evaluating the expression. [ruby-dev:35967]
|
||||||
|
|
||||||
Mon Aug 25 22:46:01 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
Mon Aug 25 22:46:01 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* test/ruby/test_thread.rb (test_status_and_stop_p): reduce the risk
|
* test/ruby/test_thread.rb (test_status_and_stop_p): reduce the risk
|
||||||
|
|
28
compile.c
28
compile.c
|
@ -2336,6 +2336,7 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
|
||||||
case NODE_ZARRAY:
|
case NODE_ZARRAY:
|
||||||
case NODE_AND:
|
case NODE_AND:
|
||||||
case NODE_OR:
|
case NODE_OR:
|
||||||
|
default:
|
||||||
estr = "expression";
|
estr = "expression";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2478,33 +2479,6 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
|
||||||
case NODE_CVASGN:
|
case NODE_CVASGN:
|
||||||
estr = "assignment";
|
estr = "assignment";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:{
|
|
||||||
LABEL *lstart = NEW_LABEL(nd_line(node));
|
|
||||||
LABEL *lend = NEW_LABEL(nd_line(node));
|
|
||||||
VALUE ensure = NEW_CHILD_ISEQVAL(NEW_NIL(),
|
|
||||||
rb_str_concat(rb_str_new2
|
|
||||||
("defined guard in "),
|
|
||||||
iseq->name),
|
|
||||||
ISEQ_TYPE_DEFINED_GUARD);
|
|
||||||
|
|
||||||
ADD_LABEL(ret, lstart);
|
|
||||||
COMPILE(ret, "defined expr (others)", node);
|
|
||||||
if (!lfinish[1]) {
|
|
||||||
lfinish[1] = NEW_LABEL(nd_line(node));
|
|
||||||
}
|
|
||||||
ADD_INSNL(ret, nd_line(node), branchunless, lfinish[1]);
|
|
||||||
if (needstr) {
|
|
||||||
ADD_INSN1(ret, nd_line(node), putstring, rb_str_new2("expression"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ADD_INSN1(ret, nd_line(node), putobject, Qtrue);
|
|
||||||
}
|
|
||||||
ADD_LABEL(ret, lend);
|
|
||||||
|
|
||||||
ADD_CATCH_ENTRY(CATCH_TYPE_RESCUE, lstart, lend, ensure, lfinish[1]);
|
|
||||||
return 1;
|
|
||||||
} /* end of default */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (estr != 0) {
|
if (estr != 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue