Debian Codegraph @

packages/babel-types/src/comments/inheritsComments.ts

raw
1 import inheritTrailingComments from "./inheritTrailingComments";
2 import inheritLeadingComments from "./inheritLeadingComments";
3 import inheritInnerComments from "./inheritInnerComments";
4 import type * as t from "..";
5
6 /**
7 * Inherit all unique comments from `parent` node to `child` node.
8 */
9 export default function inheritsComments<T extends t.Node>(
10 child: T,
11 parent: t.Node,
12 ): T {
13 inheritTrailingComments(child, parent);
14 inheritLeadingComments(child, parent);
15 inheritInnerComments(child, parent);
16
17 return child;
18 }