diff options
-rw-r--r-- | src/nvim/viml/parser/expressions.c | 9 | ||||
-rw-r--r-- | test/functional/api/vim_spec.lua | 7 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 3403fb7926..d036d9e8a3 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -1264,21 +1264,12 @@ static bool viml_pexpr_handle_bop(const ParserState *const pstate, ExprASTStack || bop_node->type == kExprNodeSubscript) ? kEOpLvlSubscript : node_lvl(*bop_node)); -#ifndef NDEBUG - const ExprOpAssociativity bop_node_ass = ( - (bop_node->type == kExprNodeCall - || bop_node->type == kExprNodeSubscript) - ? kEOpAssLeft - : node_ass(*bop_node)); -#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); const ExprOpAssociativity new_top_node_ass = node_ass(*new_top_node); - assert(bop_node_lvl != new_top_node_lvl - || bop_node_ass == new_top_node_ass); if (top_node_p != NULL && ((bop_node_lvl > new_top_node_lvl || (bop_node_lvl == new_top_node_lvl diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 035c8f70de..4210b7ecf0 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -2938,6 +2938,13 @@ describe('API', function() return ('%s(%s)%s'):format(typ, args, rest) end end + + it('does not crash parsing invalid VimL expression #29648', function() + api.nvim_input(':<C-r>=') + api.nvim_input('1bork/') + assert_alive() + end) + require('test.unit.viml.expressions.parser_tests')(it, _check_parsing, hl, fmtn) end) |