MCPcopy Create free account
hub / github.com/F-Stack/f-stack / check_conflict

Function check_conflict

app/redis-6.2.6/deps/lua/src/lparser.c:912–932  ·  view source on GitHub ↗

** check whether, in an assignment to a local variable, the local variable ** is needed in a previous assignment (to a table). If so, save original ** local value in a safe place and use this safe copy in the previous ** assignment. */

Source from the content-addressed store, hash-verified

910** assignment.
911*/
912static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) {
913 FuncState *fs = ls->fs;
914 int extra = fs->freereg; /* eventual position to save local variable */
915 int conflict = 0;
916 for (; lh; lh = lh->prev) {
917 if (lh->v.k == VINDEXED) {
918 if (lh->v.u.s.info == v->u.s.info) { /* conflict? */
919 conflict = 1;
920 lh->v.u.s.info = extra; /* previous assignment will use safe copy */
921 }
922 if (lh->v.u.s.aux == v->u.s.info) { /* conflict? */
923 conflict = 1;
924 lh->v.u.s.aux = extra; /* previous assignment will use safe copy */
925 }
926 }
927 }
928 if (conflict) {
929 luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0); /* make copy */
930 luaK_reserveregs(fs, 1);
931 }
932}
933
934
935static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {

Callers 1

assignmentFunction · 0.70

Calls 2

luaK_codeABCFunction · 0.70
luaK_reserveregsFunction · 0.70

Tested by

no test coverage detected