summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-17 22:30:52 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-17 22:30:52 +0900
commitc8e9e0b74b7fb2e225af8708426389db88f80683 (patch)
treeb746baad42a557a9e353c09d2d081a9cd8cd84fb /parse.y
parent01b3a3804334be19d013526d3edde2b84399ae43 (diff)
Fix wrong "void value expression" error
* parse.y (value_expr_check): `then` or `else` only `if` is not a void value expression, as the counterpart is evaluated as `nil`. [Bug #15932]
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y6
1 files changed, 2 insertions, 4 deletions
diff --git a/parse.y b/parse.y
index eb00b7ce3a..b966a0abc9 100644
--- a/parse.y
+++ b/parse.y
@@ -10552,12 +10552,10 @@ value_expr_check(struct parser_params *p, NODE *node)
case NODE_IF:
case NODE_UNLESS:
if (!node->nd_body) {
- node = node->nd_else;
- break;
+ return NULL;
}
else if (!node->nd_else) {
- node = node->nd_body;
- break;
+ return NULL;
}
vn = value_expr_check(p, node->nd_body);
if (!vn) return NULL;