diff options
Diffstat (limited to 'src/nvim/api/vim.c')
| -rw-r--r-- | src/nvim/api/vim.c | 11 | 
1 files changed, 6 insertions, 5 deletions
| diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index db2f25a2a6..975446057c 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -182,19 +182,20 @@ Object nvim_eval(String expr, Error *err)    Object rv = OBJECT_INIT;    // Evaluate the expression    try_start(); -  typval_T *expr_result = eval_expr((char_u *)expr.data, NULL); -  if (!expr_result) { +  typval_T rettv; +  if (eval0((char_u *)expr.data, &rettv, NULL, true) == FAIL) {      api_set_error(err, Exception, "Failed to evaluate expression");    }    if (!try_end(err)) {      // No errors, convert the result -    rv = vim_to_object(expr_result); +    rv = vim_to_object(&rettv);    } -  // Free the vim object -  free_tv(expr_result); +  // Free the Vim object +  tv_clear(&rettv); +    return rv;  } | 
