From a359ad7a16966c8955ec29e287b78d6a71dd0030 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 3 Mar 2023 10:09:30 +0800 Subject: fix flatten level > 0 issue in to_ast function. --- src/yuescript/yuescript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/yuescript/yuescript.cpp b/src/yuescript/yuescript.cpp index 1a1752c..b5043e0 100644 --- a/src/yuescript/yuescript.cpp +++ b/src/yuescript/yuescript.cpp @@ -258,7 +258,7 @@ static int yuetoast(lua_State* L) { } case 1: { if (flattenLevel > 1 || (flattenLevel == 1 && !current.hasSep)) { - lua_rawgeti(L, tableIndex, 1); + lua_rawgeti(L, tableIndex, lua_objlen(L, tableIndex) + 1); getName(node); lua_rawseti(L, -2, 1); lua_pushinteger(L, node->m_begin.m_line); -- cgit v1.2.3-55-g6feb