| 1793 | * @returns {AstNode[] | undefined} the child list, or undefined |
| 1794 | */ |
| 1795 | const childrenOf = (parent) => { |
| 1796 | if (!parent) return undefined; |
| 1797 | switch (A.type(parent)) { |
| 1798 | case NodeType.Function: |
| 1799 | case NodeType.SimpleBlock: |
| 1800 | case NodeType.Declaration: |
| 1801 | return A.children(parent); |
| 1802 | case NodeType.AtRule: |
| 1803 | case NodeType.QualifiedRule: |
| 1804 | return A.prelude(parent); |
| 1805 | default: |
| 1806 | return undefined; |
| 1807 | } |
| 1808 | }; |
| 1809 | |
| 1810 | // `allowImport` mirrors `allowImportAtRule`: true until the first top-level block-bearing rule. |
| 1811 | let allowImport = true; |