|
@@ -189,15 +189,17 @@ static int luaB_close (lua_State *L) {
|
|
|
return 2;
|
|
return 2;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- case COS_RUN: /* running coroutine? */
|
|
|
|
|
|
|
+ case COS_NORM:
|
|
|
|
|
+ return luaL_error(L, "cannot close a %s coroutine", statname[status]);
|
|
|
|
|
+ case COS_RUN:
|
|
|
lua_geti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD); /* get main */
|
|
lua_geti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD); /* get main */
|
|
|
if (lua_tothread(L, -1) == co)
|
|
if (lua_tothread(L, -1) == co)
|
|
|
return luaL_error(L, "cannot close main thread");
|
|
return luaL_error(L, "cannot close main thread");
|
|
|
lua_closethread(co, L); /* close itself */
|
|
lua_closethread(co, L); /* close itself */
|
|
|
- lua_assert(0); /* previous call does not return */
|
|
|
|
|
|
|
+ /* previous call does not return *//* FALLTHROUGH */
|
|
|
|
|
+ default:
|
|
|
|
|
+ lua_assert(0);
|
|
|
return 0;
|
|
return 0;
|
|
|
- default: /* normal or running coroutine */
|
|
|
|
|
- return luaL_error(L, "cannot close a %s coroutine", statname[status]);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|