MCPcopy
hub / github.com/webpack/webpack / _soaAlloc

Function _soaAlloc

lib/css/syntax.js:1773–1788  ·  view source on GitHub ↗
(type, start, end)

Source from the content-addressed store, hash-verified

1771};
1772/** @type {(type: number, start: number, end: number) => Node} */
1773const _soaAlloc = (type, start, end) => {
1774 // Ids are 1-based: a node ref is used in truthiness checks (`if (!parent)`),
1775 // so 0 must stay reserved for "no node".
1776 const i = _soaN + 1;
1777 if (i >= _soaCap) _soaGrow(i + 1);
1778 _soaTy[i] = type;
1779 _soaSt[i] = start;
1780 _soaEn[i] = end;
1781 _soaFl[i] = 0;
1782 // Clear list slots so a reused id never exposes a previous node's children.
1783 _soaL0[i] = null;
1784 _soaL1[i] = null;
1785 _soaL2[i] = null;
1786 _soaN = i;
1787 return _ref(i);
1788};
1789// Raw token value (the lazy `Token.value` form): hash / at-keyword drop their
1790// one-char prefix, url uses its content range. Shared by the parser's
1791// mid-parse reads and the SoA accessor.

Callers 1

useSoaBackendFunction · 0.85

Calls 2

_soaGrowFunction · 0.85
_refFunction · 0.85

Tested by

no test coverage detected