aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/viml/parser/expressions.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-01-04 02:29:39 +0100
committerJustin M. Keyes <justinkz@gmail.com>2019-01-04 02:29:38 +0100
commit6abdc0aeecc321afae975c5d4740ceacc38c4570 (patch)
treec0acc47d3d41589a54125d5479174c0c57593cfb /src/nvim/viml/parser/expressions.c
parent788ade1d29733f798ec51f192f58082c5b07acb4 (diff)
downloadrneovim-6abdc0aeecc321afae975c5d4740ceacc38c4570.tar.gz
rneovim-6abdc0aeecc321afae975c5d4740ceacc38c4570.tar.bz2
rneovim-6abdc0aeecc321afae975c5d4740ceacc38c4570.zip
PVS/V547: viml/parser/expressions.c: Expression is always true
Diffstat (limited to 'src/nvim/viml/parser/expressions.c')
-rw-r--r--src/nvim/viml/parser/expressions.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c
index 1a7e55c11e..dcc64db8a0 100644
--- a/src/nvim/viml/parser/expressions.c
+++ b/src/nvim/viml/parser/expressions.c
@@ -2845,30 +2845,32 @@ viml_pexpr_parse_no_paren_closing_error: {}
kvi_push(ast_stack, new_top_node_p);
want_node = kENodeOperator;
} else {
- if (want_node == kENodeValue) {
- NEW_NODE_WITH_CUR_POS(cur_node, kExprNodeNested);
- *top_node_p = cur_node;
- kvi_push(ast_stack, &cur_node->children);
- HL_CUR_TOKEN(NestingParenthesis);
- } else if (want_node == kENodeOperator) {
- if (prev_token.type == kExprLexSpacing) {
- // For some reason "function (args)" is a function call, but
- // "(funcref) (args)" is not. AFAIR this somehow involves
- // compatibility and Bram was commenting that this is
- // intentionally inconsistent and he is not very happy with the
- // situation himself.
- if ((*top_node_p)->type != kExprNodePlainIdentifier
- && (*top_node_p)->type != kExprNodeComplexIdentifier
- && (*top_node_p)->type != kExprNodeCurlyBracesIdentifier) {
- OP_MISSING;
+ switch (want_node) {
+ case kENodeValue: {
+ NEW_NODE_WITH_CUR_POS(cur_node, kExprNodeNested);
+ *top_node_p = cur_node;
+ kvi_push(ast_stack, &cur_node->children);
+ HL_CUR_TOKEN(NestingParenthesis);
+ break;
+ }
+ case kENodeOperator: {
+ if (prev_token.type == kExprLexSpacing) {
+ // For some reason "function (args)" is a function call, but
+ // "(funcref) (args)" is not. AFAIR this somehow involves
+ // compatibility and Bram was commenting that this is
+ // intentionally inconsistent and he is not very happy with the
+ // situation himself.
+ if ((*top_node_p)->type != kExprNodePlainIdentifier
+ && (*top_node_p)->type != kExprNodeComplexIdentifier
+ && (*top_node_p)->type != kExprNodeCurlyBracesIdentifier) {
+ OP_MISSING;
+ }
}
+ NEW_NODE_WITH_CUR_POS(cur_node, kExprNodeCall);
+ ADD_OP_NODE(cur_node);
+ HL_CUR_TOKEN(CallingParenthesis);
+ break;
}
- NEW_NODE_WITH_CUR_POS(cur_node, kExprNodeCall);
- ADD_OP_NODE(cur_node);
- HL_CUR_TOKEN(CallingParenthesis);
- } else {
- // Currently it is impossible to reach this.
- assert(false);
}
want_node = kENodeValue;
}