MCPcopy Create free account
hub / github.com/arktypeio/arktype / untilUnchanged

Function untilUnchanged

ark/aot/flat.ts:1555–1569  ·  view source on GitHub ↗
(
	{ body, returned }: WrittenUnits,
	parse: UnitsParser,
	pass: UnitsPass
)

Source from the content-addressed store, hash-verified

1553) => boolean | void
1554
1555const untilUnchanged = (
1556 { body, returned }: WrittenUnits,
1557 parse: UnitsParser,
1558 pass: UnitsPass
1559): WrittenUnits => {
1560 for (;;) {
1561 const code = `${body}\n;${returned}`
1562 const s = new MagicString(code)
1563 const isSettled = pass(parse(code), s, body)
1564 if (!s.hasChanged()) return { body, returned }
1565 returned = s.slice(body.length + 2, code.length)
1566 body = s.slice(0, body.length)
1567 if (isSettled) return { body, returned }
1568 }
1569}
1570
1571// a constant declared as another, or a function only forwarding its parameters, is read as that one
1572const skipAliases: UnitsPass = ({ program, scopes }, s) => {

Callers 1

writtenUnitsOfFunction · 0.85

Calls 1

parseFunction · 0.70

Tested by

no test coverage detected