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

Function codeconcat

third-party/lua-5.5.0/src/lcode.c:1767–1781  ·  view source on GitHub ↗

** Create code for '(e1 .. e2)'. ** For '(e1 .. e2.1 .. e2.2)' (which is '(e1 .. (e2.1 .. e2.2))', ** because concatenation is right associative), merge both CONCATs. */

Source from the content-addressed store, hash-verified

1765** because concatenation is right associative), merge both CONCATs.
1766*/
1767static void codeconcat (FuncState *fs, expdesc *e1, expdesc *e2, int line) {
1768 Instruction *ie2 = previousinstruction(fs);
1769 if (GET_OPCODE(*ie2) == OP_CONCAT) { /* is 'e2' a concatenation? */
1770 int n = GETARG_B(*ie2); /* # of elements concatenated in 'e2' */
1771 lua_assert(e1->u.info + 1 == GETARG_A(*ie2));
1772 freeexp(fs, e2);
1773 SETARG_A(*ie2, e1->u.info); /* correct first element ('e1') */
1774 SETARG_B(*ie2, n + 1); /* will concatenate one more element */
1775 }
1776 else { /* 'e2' is not a concatenation */
1777 luaK_codeABC(fs, OP_CONCAT, e1->u.info, 2, 0); /* new concat opcode */
1778 freeexp(fs, e2);
1779 luaK_fixline(fs, line);
1780 }
1781}
1782
1783
1784/*

Callers 1

luaK_posfixFunction · 0.70

Calls 4

previousinstructionFunction · 0.70
freeexpFunction · 0.70
luaK_fixlineFunction · 0.70
luaK_codeABCFunction · 0.50

Tested by

no test coverage detected