MCPcopy Create free account
hub / github.com/axmolengine/axmol / codeconcat

Function codeconcat

3rdparty/lua/plainlua/lcode.c:1686–1700  ·  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

1684** because concatenation is right associative), merge both CONCATs.
1685*/
1686static void codeconcat (FuncState *fs, expdesc *e1, expdesc *e2, int line) {
1687 Instruction *ie2 = previousinstruction(fs);
1688 if (GET_OPCODE(*ie2) == OP_CONCAT) { /* is 'e2' a concatenation? */
1689 int n = GETARG_B(*ie2); /* # of elements concatenated in 'e2' */
1690 lua_assert(e1->u.info + 1 == GETARG_A(*ie2));
1691 freeexp(fs, e2);
1692 SETARG_A(*ie2, e1->u.info); /* correct first element ('e1') */
1693 SETARG_B(*ie2, n + 1); /* will concatenate one more element */
1694 }
1695 else { /* 'e2' is not a concatenation */
1696 luaK_codeABC(fs, OP_CONCAT, e1->u.info, 2, 0); /* new concat opcode */
1697 freeexp(fs, e2);
1698 luaK_fixline(fs, line);
1699 }
1700}
1701
1702
1703/*

Callers 1

luaK_posfixFunction · 0.85

Calls 3

previousinstructionFunction · 0.85
freeexpFunction · 0.85
luaK_fixlineFunction · 0.85

Tested by

no test coverage detected