MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / fixforjump

Function fixforjump

3rd/lua-5.4.3/src/lparser.c:1518–1526  ·  view source on GitHub ↗

** Fix for instruction at position 'pc' to jump to 'dest'. ** (Jump addresses are relative in Lua). 'back' true means ** a back jump. */

Source from the content-addressed store, hash-verified

1516** a back jump.
1517*/
1518static void fixforjump (FuncState *fs, int pc, int dest, int back) {
1519 Instruction *jmp = &fs->f->code[pc];
1520 int offset = dest - (pc + 1);
1521 if (back)
1522 offset = -offset;
1523 if (l_unlikely(offset > MAXARG_Bx))
1524 luaX_syntaxerror(fs->ls, "control structure too long");
1525 SETARG_Bx(*jmp, offset);
1526}
1527
1528
1529/*

Callers 1

forbodyFunction · 0.85

Calls 1

luaX_syntaxerrorFunction · 0.85

Tested by

no test coverage detected