| 68 | // Span-less constructor used only by parser/compiler unit tests; the real |
| 69 | // pipeline always carries source spans via `new_with_spans`. |
| 70 | #[cfg(test)] |
| 71 | pub fn new(tokens: Vec<Token<'a>>) -> Self { |
| 72 | let spans = vec![Span::default(); tokens.len()]; |
| 73 | Self { |
| 74 | tokens, |
| 75 | spans, |
| 76 | pos: 0, |
| 77 | pending_gt_from_shr: false, |
| 78 | type_names: std::collections::HashSet::new(), |
| 79 | enum_names: prelude_enum_names(), |
| 80 | synthesized_declarations: Vec::new(), |
| 81 | next_lambda_id: 0, |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | pub fn new_with_spans(token_spans: Vec<(Token<'a>, Span)>) -> Self { |
| 86 | let (tokens, spans): (Vec<_>, Vec<_>) = token_spans.into_iter().unzip(); |
| 87 | Self { |
| 88 | tokens, |
| 89 | spans, |
| 90 | pos: 0, |
| 91 | pending_gt_from_shr: false, |
| 92 | type_names: std::collections::HashSet::new(), |
| 93 | enum_names: prelude_enum_names(), |
| 94 | synthesized_declarations: Vec::new(), |
| 95 | next_lambda_id: 0, |