Merge branch 'master' into luaviml'/lua

This commit is contained in:
ZyX
2017-04-08 01:54:58 +03:00
207 changed files with 16096 additions and 9169 deletions

View File

@@ -22,6 +22,7 @@
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/option.h"
#include "nvim/syntax.h"
#include "nvim/getchar.h"
@@ -181,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) {
api_set_error(err, Exception, _("Failed to evaluate expression"));
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;
}
@@ -238,11 +240,11 @@ Object nvim_call_function(String fname, Array args, Error *err)
if (!try_end(err)) {
rv = vim_to_object(&rettv);
}
clear_tv(&rettv);
tv_clear(&rettv);
free_vim_args:
while (i > 0) {
clear_tv(&vim_args[--i]);
tv_clear(&vim_args[--i]);
}
return rv;
@@ -439,7 +441,7 @@ Object nvim_get_vvar(String name, Error *err)
///
/// @param name Option name
/// @param[out] err Error details, if any
/// @return Option value
/// @return Option value (global)
Object nvim_get_option(String name, Error *err)
FUNC_API_SINCE(1)
{