(
&mut self,
ast: &'a ast::ClassBracketed,
visitor: &mut V,
)
| 328 | } |
| 329 | |
| 330 | fn visit_class<V: Visitor>( |
| 331 | &mut self, |
| 332 | ast: &'a ast::ClassBracketed, |
| 333 | visitor: &mut V, |
| 334 | ) -> Result<(), V::Err> { |
| 335 | let mut ast = ClassInduct::from_bracketed(ast); |
| 336 | loop { |
| 337 | self.visit_class_pre(&ast, visitor)?; |
| 338 | if let Some(x) = self.induct_class(&ast) { |
| 339 | let child = x.child(); |
| 340 | self.stack_class.push((ast, x)); |
| 341 | ast = child; |
| 342 | continue; |
| 343 | } |
| 344 | self.visit_class_post(&ast, visitor)?; |
| 345 | |
| 346 | // At this point, we now try to pop our call stack until it is |
| 347 | // either empty or we hit another inductive case. |
| 348 | loop { |
| 349 | let (post_ast, frame) = match self.stack_class.pop() { |
| 350 | None => return Ok(()), |
| 351 | Some((post_ast, frame)) => (post_ast, frame), |
| 352 | }; |
| 353 | // If this is a union or a binary op, then we might have |
| 354 | // additional inductive steps to process. |
| 355 | if let Some(x) = self.pop_class(frame) { |
| 356 | if let ClassFrame::BinaryRHS { ref op, .. } = x { |
| 357 | visitor.visit_class_set_binary_op_in(op)?; |
| 358 | } |
| 359 | ast = x.child(); |
| 360 | self.stack_class.push((post_ast, x)); |
| 361 | break; |
| 362 | } |
| 363 | // Otherwise, we've finished visiting all the child nodes for |
| 364 | // this class node, so we can post visit it now. |
| 365 | self.visit_class_post(&post_ast, visitor)?; |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | /// Call the appropriate `Visitor` methods given an inductive step. |
| 371 | fn visit_class_pre<V: Visitor>( |
no test coverage detected