Don't prefix classes in arbitrary variants #10214
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We were incorrectly prefixing classes in arbitrary variants if the first variant wasn't an arbitrary variant. Additionally, if the first variant was arbitrary then all classes in all variants would end up un-prefixed. For example:
These would result in the selectors:
Notice how:
group
class prefixed like it should.foo
class prefixed when it should not.Here we rework the functions
finalizeSelector
andformatVariantSelector
together to take multiple formats. They were previously using a mix for AST and string-based parsing. This now does the full transformation using the selector AST, parses the format strings AST as early as possible, and is set up to parse them only once for a given set of rules. All of this will allow considering metadata on a per format string basis. For instance, we now know if the format string.foo &
was produced by a normal variant or by an arbitrary variant. We use this information to control the prefixing behavior for individual format strings.Fixes #10125