(declarations, childRules)
| 584 | * @returns {{ hasDirectDecl: boolean, hasNestedBlock: boolean }} scan result |
| 585 | */ |
| 586 | const scanRuleBody = (declarations, childRules) => { |
| 587 | let hasDirectDecl = Boolean(declarations && declarations.length > 0); |
| 588 | let hasNestedBlock = false; |
| 589 | if (childRules) { |
| 590 | for (const child of childRules) { |
| 591 | const t = A.type(child); |
| 592 | if (t === NodeType.QualifiedRule) { |
| 593 | hasNestedBlock = true; |
| 594 | } else if (t === NodeType.AtRule) { |
| 595 | const atDecls = A.declarations(child); |
| 596 | const atChildRules = A.childRules(child); |
| 597 | if (!atDecls && !atChildRules) continue; |
| 598 | hasNestedBlock = true; |
| 599 | if ( |
| 600 | !hasDirectDecl && |
| 601 | !isPureBodyAtRule(`@${A.name(child).toLowerCase()}`) && |
| 602 | scanRuleBody(atDecls, atChildRules).hasDirectDecl |
| 603 | ) { |
| 604 | hasDirectDecl = true; |
| 605 | } |
| 606 | } |
| 607 | } |
| 608 | } |
| 609 | return { hasDirectDecl, hasNestedBlock }; |
| 610 | }; |
| 611 | |
| 612 | /** |
| 613 | * Parses value at rule params. |
no test coverage detected