Store selectors and combinators inline in a single sequence.

This improves cache locality and reduces allocations during parsing.

Note that this reverses the iteration order within a sequence of simple selectors,
but that shouldn't matter.
This commit is contained in:
Bobby Holley 2017-04-18 23:43:39 -07:00
parent 93fa0ae1e3
commit 6d66ec5e11
10 changed files with 703 additions and 330 deletions

View file

@ -6,7 +6,8 @@
#![deny(missing_docs)]
use parser::{AttrSelector, Combinator, ComplexSelector, SelectorImpl, SimpleSelector};
use parser::{AttrSelector, Combinator, SelectorImpl};
use parser::{SelectorIter, SimpleSelector};
/// A trait to visit selector properties.
///
@ -33,7 +34,7 @@ pub trait SelectorVisitor {
/// Gets the combinator to the right of the selector, or `None` if the
/// selector is the leftmost one.
fn visit_complex_selector(&mut self,
_: &ComplexSelector<Self::Impl>,
_: SelectorIter<Self::Impl>,
_combinator_to_right: Option<Combinator>)
-> bool {
true