aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/viml/parser/expressions.c
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-09-26 00:52:40 +0300
committerZyX <kp-pav@yandex.ru>2017-10-08 22:25:07 +0300
commit3cc65ac054976ef7520f0247b430ebef2f9537b7 (patch)
tree9374db93f32b5b837a6e19879d6ef37275aa05b0 /src/nvim/viml/parser/expressions.c
parentd4782fb1ca05e76095086bdcbc8dcea47f532d00 (diff)
downloadrneovim-3cc65ac054976ef7520f0247b430ebef2f9537b7.tar.gz
rneovim-3cc65ac054976ef7520f0247b430ebef2f9537b7.tar.bz2
rneovim-3cc65ac054976ef7520f0247b430ebef2f9537b7.zip
viml/parser/expressions: Make commas actually work when calling
Diffstat (limited to 'src/nvim/viml/parser/expressions.c')
-rw-r--r--src/nvim/viml/parser/expressions.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c
index b9abf4a067..7bee779c49 100644
--- a/src/nvim/viml/parser/expressions.c
+++ b/src/nvim/viml/parser/expressions.c
@@ -681,24 +681,22 @@ static void viml_pexpr_handle_bop(ExprASTStack *const ast_stack,
ExprOpLvl top_node_lvl;
ExprOpAssociativity top_node_ass;
assert(kv_size(*ast_stack));
-#define NODE_LVL(typ) \
- (bop_node->type == kExprNodeCall && typ == kExprNodeCall \
- ? kEOpLvlSubscript \
- : node_type_to_op_lvl[typ])
-#define NODE_ASS(typ) \
- (bop_node->type == kExprNodeCall && typ == kExprNodeCall \
- ? kEOpAssLeft \
- : node_type_to_op_ass[typ])
- const ExprOpLvl bop_node_lvl = NODE_LVL(bop_node->type);
+ const ExprOpLvl bop_node_lvl = (bop_node->type == kExprNodeCall
+ ? kEOpLvlSubscript
+ : node_type_to_op_lvl[bop_node->type]);
#ifndef NDEBUG
- const ExprOpAssociativity bop_node_ass = NODE_ASS(bop_node->type);
+ const ExprOpAssociativity bop_node_ass = (
+ bop_node->type == kExprNodeCall
+ ? kEOpAssLeft
+ : node_type_to_op_ass[bop_node->type]);
#endif
do {
ExprASTNode **new_top_node_p = kv_last(*ast_stack);
ExprASTNode *new_top_node = *new_top_node_p;
assert(new_top_node != NULL);
- const ExprOpLvl new_top_node_lvl = NODE_LVL(new_top_node->type);
- const ExprOpAssociativity new_top_node_ass = NODE_ASS(new_top_node->type);
+ const ExprOpLvl new_top_node_lvl = node_type_to_op_lvl[new_top_node->type];
+ const ExprOpAssociativity new_top_node_ass = (
+ node_type_to_op_ass[new_top_node->type]);
assert(bop_node_lvl != new_top_node_lvl
|| bop_node_ass == new_top_node_ass);
if (top_node_p != NULL
@@ -751,8 +749,6 @@ static void viml_pexpr_handle_bop(ExprASTStack *const ast_stack,
*want_node_p = (*want_node_p == kENodeArgumentSeparator
? kENodeArgument
: kENodeValue);
-#undef NODE_ASS
-#undef NODE_LVL
}
/// ParserPosition literal based on ParserPosition pos with columns shifted