treesitter: fix lint

This commit is contained in:
Thomas Vigouroux
2020-06-23 09:08:56 +02:00
parent b652f74ca3
commit 35cc8b6e83

View File

@@ -387,8 +387,9 @@ static int parser_edit(lua_State *L)
static int parser_set_ranges(lua_State *L) static int parser_set_ranges(lua_State *L)
{ {
if (lua_gettop(L) < 2) { if (lua_gettop(L) < 2) {
lua_pushstring(L, "not enough args to parser:set_included_ranges()"); return luaL_error(
return lua_error(L); L,
"not enough args to parser:set_included_ranges()");
} }
TSLua_parser *p = parser_check(L); TSLua_parser *p = parser_check(L);
@@ -397,8 +398,9 @@ static int parser_set_ranges(lua_State *L)
} }
if (!lua_istable(L, 2)) { if (!lua_istable(L, 2)) {
lua_pushstring(L, "argument for parser:set_included_ranges() should be a table."); return luaL_error(
return lua_error(L); L,
"argument for parser:set_included_ranges() should be a table.");
} }
size_t tbl_len = lua_objlen(L, 2); size_t tbl_len = lua_objlen(L, 2);
@@ -411,18 +413,16 @@ static int parser_set_ranges(lua_State *L)
if (!lua_istable(L, -1)) { if (!lua_istable(L, -1)) {
xfree(ranges); xfree(ranges);
lua_pushstring( return luaL_error(
L, L,
"argument for parser:set_included_ranges() should be a table of tables."); "argument for parser:set_included_ranges() should be a table of tables.");
return lua_error(L);
} }
if (lua_objlen(L, -1) != 2) { if (lua_objlen(L, -1) != 2) {
xfree(ranges); xfree(ranges);
lua_pushstring( return luaL_error(
L, L,
"argument for parser:set_included_ranges() should be a table of ranges of 2 elements."); "argument for parser:set_included_ranges() should be a table of ranges of 2 elements.");
return lua_error(L);
} }
@@ -560,7 +560,7 @@ static bool node_check(lua_State *L, int index, TSNode *res)
static int node_tostring(lua_State *L) static int node_tostring(lua_State *L)
{ {
TSNode node; TSNode node;
if (!node_check(L,1, &node)) { if (!node_check(L, 1, &node)) {
return 0; return 0;
} }
lua_pushstring(L, "<node "); lua_pushstring(L, "<node ");
@@ -619,7 +619,7 @@ static int node_start(lua_State *L)
static int node_end(lua_State *L) static int node_end(lua_State *L)
{ {
TSNode node; TSNode node;
if (!node_check(L,1, &node)) { if (!node_check(L, 1, &node)) {
return 0; return 0;
} }
TSPoint end = ts_node_end_point(node); TSPoint end = ts_node_end_point(node);
@@ -644,7 +644,7 @@ static int node_child_count(lua_State *L)
static int node_named_child_count(lua_State *L) static int node_named_child_count(lua_State *L)
{ {
TSNode node; TSNode node;
if (!node_check(L,1, &node)) { if (!node_check(L, 1, &node)) {
return 0; return 0;
} }
uint32_t count = ts_node_named_child_count(node); uint32_t count = ts_node_named_child_count(node);