12345678910111213141516171819202122232425262728293031323334353637 |
- "use strict";
- exports.__esModule = true;
- function defineParents(node, parent) {
- if (parent === void 0) { parent = null; }
- if ("children" in node) {
- node.children.forEach(function (child) {
- return defineParents(child, node);
- });
- }
- if ("anchor" in node && node.anchor) {
- defineParents(node.anchor, node);
- }
- if ("tag" in node && node.tag) {
- defineParents(node.tag, node);
- }
- // istanbul ignore next
- if ("leadingComments" in node) {
- node.leadingComments.forEach(function (comment) { return defineParents(comment, node); });
- }
- if ("middleComments" in node) {
- node.middleComments.forEach(function (comment) { return defineParents(comment, node); });
- }
- if ("indicatorComment" in node && node.indicatorComment) {
- defineParents(node.indicatorComment, node);
- }
- if ("trailingComment" in node && node.trailingComment) {
- defineParents(node.trailingComment, node);
- }
- if ("endComments" in node) {
- node.endComments.forEach(function (comment) { return defineParents(comment, node); });
- }
- Object.defineProperty(node, "_parent", {
- value: parent,
- enumerable: false
- });
- }
- exports.defineParents = defineParents;
|