| 1816 | } |
| 1817 | |
| 1818 | static void lpbD_map(lpb_Env *e, const pb_Field *f) { |
| 1819 | lua_State *L = e->L; |
| 1820 | pb_Slice p, *s = e->s; |
| 1821 | int mask = 0, top = lua_gettop(L); |
| 1822 | uint32_t tag; |
| 1823 | lpb_readbytes(L, s, &p); |
| 1824 | if (f->type == NULL) return; |
| 1825 | lua_pushnil(L); |
| 1826 | lua_pushnil(L); |
| 1827 | while (pb_readvarint32(&p, &tag)) { |
| 1828 | int n = pb_gettag(tag); |
| 1829 | if (n == 1 || n == 2) { |
| 1830 | mask |= n; |
| 1831 | lpb_withinput(e, &p, lpbD_field(e, pb_field(f->type, n), tag)); |
| 1832 | lua_replace(L, top+n); |
| 1833 | } |
| 1834 | } |
| 1835 | if (!(mask & 1) && lpb_pushdeffield(L, e->LS, pb_field(f->type, 1), 1)) |
| 1836 | lua_replace(L, top + 1), mask |= 1; |
| 1837 | if (!(mask & 2) && lpb_pushdeffield(L, e->LS, pb_field(f->type, 2), 1)) |
| 1838 | lua_replace(L, top + 2), mask |= 2; |
| 1839 | if (mask == 3) lua_rawset(L, -3); else lua_pop(L, 2); |
| 1840 | } |
| 1841 | |
| 1842 | static void lpbD_repeated(lpb_Env *e, const pb_Field *f, uint32_t tag) { |
| 1843 | lua_State *L = e->L; |
no test coverage detected