aboutsummaryrefslogtreecommitdiff
path: root/src/lua/lundump.c
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-07-18 16:45:50 +0800
committerLi Jin <dragon-fly@qq.com>2020-07-18 16:45:50 +0800
commit8c596dc1efa8a1267c222b168a4de9c8ba254760 (patch)
tree699c748e101a48ae267b5f7b19adbfea15f3934e /src/lua/lundump.c
parent8ab0038c09a79fa8401bb10b7a31d03ef5380417 (diff)
downloadyuescript-8c596dc1efa8a1267c222b168a4de9c8ba254760.tar.gz
yuescript-8c596dc1efa8a1267c222b168a4de9c8ba254760.tar.bz2
yuescript-8c596dc1efa8a1267c222b168a4de9c8ba254760.zip
fix issue for using return statement with export.
Diffstat (limited to 'src/lua/lundump.c')
-rw-r--r--src/lua/lundump.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lua/lundump.c b/src/lua/lundump.c
index 4243678..cb124d6 100644
--- a/src/lua/lundump.c
+++ b/src/lua/lundump.c
@@ -200,13 +200,20 @@ static void loadProtos (LoadState *S, Proto *f) {
200} 200}
201 201
202 202
203/*
204** Load the upvalues for a function. The names must be filled first,
205** because the filling of the other fields can raise read errors and
206** the creation of the error message can call an emergency collection;
207** in that case all prototypes must be consistent for the GC.
208*/
203static void loadUpvalues (LoadState *S, Proto *f) { 209static void loadUpvalues (LoadState *S, Proto *f) {
204 int i, n; 210 int i, n;
205 n = loadInt(S); 211 n = loadInt(S);
206 f->upvalues = luaM_newvectorchecked(S->L, n, Upvaldesc); 212 f->upvalues = luaM_newvectorchecked(S->L, n, Upvaldesc);
207 f->sizeupvalues = n; 213 f->sizeupvalues = n;
208 for (i = 0; i < n; i++) { 214 for (i = 0; i < n; i++) /* make array valid for GC */
209 f->upvalues[i].name = NULL; 215 f->upvalues[i].name = NULL;
216 for (i = 0; i < n; i++) { /* following calls can raise errors */
210 f->upvalues[i].instack = loadByte(S); 217 f->upvalues[i].instack = loadByte(S);
211 f->upvalues[i].idx = loadByte(S); 218 f->upvalues[i].idx = loadByte(S);
212 f->upvalues[i].kind = loadByte(S); 219 f->upvalues[i].kind = loadByte(S);