@function selectorToString ($selector) {
  $selector: inspect($selector);
  $selector: str-slice($selector, 2, -2);
  @return $selector;
}

// 选择器是否包含修饰符连接符 --
@function containsModifier($selector) {
  $selector: selectorToString($selector);

  @if (str-index($selector, $modifier-separator)) {
    @return true;
  } @else {
    @return false;
  }
}

// 选择器是否包含状态前缀 .is
@function containWhenFlag($selector) {
  $selector: selectorToString($selector);

  @if (str-index($selector, '.' + $state-prefix)) {
    @return true;
  } @else {
    @return false;
  }
}

// 选择器是否包含伪类选择器
@function containPseudoClass($selector) {
  $selector: selectorToString($selector);

  @if (str-index($selector, ':')) {
    @return true;
  } @else {
    @return false;
  }
}

// 选择器是否包含 -- 或 .is 或伪类选择器
@function hitAllSpecialNestRule($selector) {
  @return containsModifier($selector) or containWhenFlag($selector) or containPseudoClass($selector);
}
