ruby-changes:37358
From: nobu <ko1@a...>
Date: Thu, 29 Jan 2015 22:22:53 +0900 (JST)
Subject: [ruby-changes:37358] nobu:r49439 (trunk): parse.y: no optimization in defined?
nobu 2015-01-29 22:22:45 +0900 (Thu, 29 Jan 2015) New Revision: 49439 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49439 Log: parse.y: no optimization in defined? * parse.y (logop_gen): no needs for optimization in defined? operator. literal conditions are optimized away eventually. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 49438) +++ parse.y (revision 49439) @@ -9678,7 +9678,7 @@ logop_gen(struct parser_params *parser, https://github.com/ruby/ruby/blob/trunk/parse.y#L9678 { value_expr(left); if (!left) { - if (type == NODE_AND) return 0; + if (!in_defined && type == NODE_AND) return 0; /* make NODE_OR not to be "void value expression" */ } else if ((enum node_type)nd_type(left) == type) { @@ -9689,7 +9689,7 @@ logop_gen(struct parser_params *parser, https://github.com/ruby/ruby/blob/trunk/parse.y#L9689 node->nd_2nd = NEW_NODE(type, second, right, 0); return left; } - else { + else if (!in_defined) { switch (nd_type(left)) { case NODE_NIL: case NODE_FALSE: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/