diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-01-04 23:45:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-04 23:45:21 +0100 |
commit | 38b4ca26b555e5bdca4d672917a85f1bd60297c2 (patch) | |
tree | 5f12bdc1175aa05709e183d8a2f7a6b1b5793997 /src/nvim/viml/parser/expressions.c | |
parent | 292b1790c8fd0c4ccf4dbff23d2cc5ed307dad08 (diff) | |
parent | 58538d121016d559e7988fa3d0ed21e07f60a2f6 (diff) | |
download | rneovim-38b4ca26b555e5bdca4d672917a85f1bd60297c2.tar.gz rneovim-38b4ca26b555e5bdca4d672917a85f1bd60297c2.tar.bz2 rneovim-38b4ca26b555e5bdca4d672917a85f1bd60297c2.zip |
Merge #9454 from justinmk/pvs-warnings
Diffstat (limited to 'src/nvim/viml/parser/expressions.c')
-rw-r--r-- | src/nvim/viml/parser/expressions.c | 46 |
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; } |