Call `f` for each of the terms in this pattern.
(&self, f: &mut dyn FnMut(Pos, &Ident))
| 379 | |
| 380 | /// Call `f` for each of the terms in this pattern. |
| 381 | pub fn terms(&self, f: &mut dyn FnMut(Pos, &Ident)) { |
| 382 | match self { |
| 383 | Pattern::Term { sym, args, pos } => { |
| 384 | f(*pos, sym); |
| 385 | for arg in args { |
| 386 | arg.terms(f); |
| 387 | } |
| 388 | } |
| 389 | Pattern::And { subpats, .. } => { |
| 390 | for p in subpats { |
| 391 | p.terms(f); |
| 392 | } |
| 393 | } |
| 394 | Pattern::BindPattern { subpat, .. } => { |
| 395 | subpat.terms(f); |
| 396 | } |
| 397 | Pattern::Var { .. } |
| 398 | | Pattern::ConstBool { .. } |
| 399 | | Pattern::ConstInt { .. } |
| 400 | | Pattern::ConstPrim { .. } |
| 401 | | Pattern::Wildcard { .. } |
| 402 | | Pattern::MacroArg { .. } => {} |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | pub fn make_macro_template(&self, macro_args: &[Ident]) -> Pattern { |
| 407 | log!("make_macro_template: {:?} with {:?}", self, macro_args); |
no test coverage detected