@tonkite/tlb-parser
Version:
Parse TL-B syntax into TypeScript objects
16 lines (12 loc) • 344 B
text/typescript
import type { Program } from './nodes';
import { walk, iterChildNodes } from './visit';
export function withParents(tree: Program): Program {
for (let parent of walk(tree)) {
for (let child of iterChildNodes(parent)) {
// We only set it here, so ignore
// @ts-ignore
child.parent = parent;
}
}
return tree;
}