diff options
-rw-r--r-- | src/default_emitter.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/default_emitter.rs b/src/default_emitter.rs index 16766c8..a4c5a63 100644 --- a/src/default_emitter.rs +++ b/src/default_emitter.rs @@ -43,7 +43,7 @@ impl<O> Iterator for DefaultEmitter<O> { impl<O: Offset> Emitter<O> for DefaultEmitter<O> { fn report_error(&mut self, error: Error, span: Range<O>) { - self.push_error(error, span); + self.emitted_tokens.push_front(Token::Error { error, span }); } fn emit_eof(&mut self) { @@ -85,7 +85,7 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> { Token::EndTag(tag) => { if !self.seen_attributes.is_empty() { let span = self.attr_in_end_tag_span.take().unwrap(); - self.push_error(Error::EndTagWithAttributes, span); + self.report_error(Error::EndTagWithAttributes, span); } self.seen_attributes.clear(); tag.span.end = offset; @@ -334,13 +334,13 @@ impl<O> DefaultEmitter<O> { vacant.insert(map_val); } Entry::Occupied(_) => { - self.push_error(Error::DuplicateAttribute, map_val.name_span); + self.report_error(Error::DuplicateAttribute, map_val.name_span); } }, Some(Token::EndTag(_)) => { self.attr_in_end_tag_span = Some(map_val.name_span.clone()); if !self.seen_attributes.insert(name) { - self.push_error(Error::DuplicateAttribute, map_val.name_span); + self.report_error(Error::DuplicateAttribute, map_val.name_span); } } _ => { @@ -358,12 +358,6 @@ impl<O> DefaultEmitter<O> { let s = mem::take(&mut self.current_characters); self.emit_token(Token::String(s)); } - - fn push_error(&mut self, error: Error, span: Range<O>) { - // bypass character flushing in self.emit_token: we don't need the error location to be - // that exact - self.emitted_tokens.push_front(Token::Error { error, span }); - } } /// The majority of our testing of the [`DefaultEmitter`] is done against the |