public boolean visit(AncestorChain<?> ancestors) {
ParseTreeNode node = ancestors.node;
if (node instanceof CssTree.SuffixedSelectorPart) {
CssTree.SuffixedSelectorPart ssp
= (CssTree.SuffixedSelectorPart) node;
MutableParseTreeNode parent = ancestors.parent.cast(
MutableParseTreeNode.class)
.node;
CssTree replacement;
if (gadgetNameSuffix == null) {
replacement = new SuffixedClassOrIdLiteral(
ssp.getFilePosition(),
ssp.typePrefix() + ssp.suffixedIdentifier(""));
} else {
String ident = ssp.suffixedIdentifier(gadgetNameSuffix);
replacement = ".".equals(ssp.typePrefix())
? new CssTree.ClassLiteral(ssp.getFilePosition(), "." + ident)
: new CssTree.IdLiteral(ssp.getFilePosition(), "#" + ident);
}
parent.replaceChild(replacement, ssp);
return false;
} else if (node instanceof CssTree.IdLiteral) {
// An un-suffixed ID literal has snuck in since CssRewriter.
throw new AssertionError();
} else {