@mixin selector-info($selector) {
  type: type-of($selector);
  length: length($selector);
  content: $selector;
  @for $i from 1 through length($selector) {
    index: $i;
    length: length(nth($selector, $i));
    type: type-of(nth($selector, $i));
    content: nth($selector, $i);
  }
}

.foo {
  @include selector-info(&);
}

.bar a {
  @include selector-info(&);
}

.bar,
.baz {
  @include selector-info(&);
}

.qux {
  &.waldo {
    .where & {
      .final {
        @include selector-info(&);
      }
    }
  }
}