diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-18 00:36:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-18 00:36:24 +0000 |
commit | 930f8c2a08158989ffb1e0ee895f263ad94eb6c0 (patch) | |
tree | ea8298dcf0d92112eb38b9721df47a5edc36cf7c /parse.y | |
parent | cf43a83e71adf3688d517c85106d6aaba48b8dd8 (diff) | |
download | ruby-930f8c2a08158989ffb1e0ee895f263ad94eb6c0.tar.gz |
parse.y: relax literal in condition warnings
* parse.y (cond0): do not warn literal boolean (true and false) in
condition expressions, as they are often used as infinite loops,
deactivated code block, etc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -9823,6 +9823,10 @@ cond0(struct parser_params *p, NODE *node, int method_op, const YYLTYPE *loc) warn_unless_e_option(p, node, "regex literal in condition"); nd_set_type(node, NODE_MATCH); } + else if (node->nd_lit == Qtrue || + node->nd_lit == Qfalse) { + /* booleans are OK, e.g., while true */ + } else { if (!method_op) parser_warning(p, node, "literal in condition"); |