MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / check_conflict

Function check_conflict

third-party/lua-5.1.5/src/lparser.c:908–928  ·  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

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