mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
* remove `Option<Vec>` from `FormalParameter` * `unwrap` -> `unwrap_or_else` * prefer `AstBuilder` helper * implement `consume_decorators`
26 lines
642 B
Rust
26 lines
642 B
Rust
use std::collections::HashSet;
|
|
|
|
use oxc_allocator::{Allocator, Vec};
|
|
use oxc_ast::ast::Decorator;
|
|
|
|
pub struct ParserState<'a> {
|
|
allocator: &'a Allocator,
|
|
|
|
pub not_parenthesized_arrow: HashSet<u32>,
|
|
|
|
pub decorators: Vec<'a, Decorator<'a>>,
|
|
}
|
|
|
|
impl<'a> ParserState<'a> {
|
|
pub fn new(allocator: &'a Allocator) -> Self {
|
|
Self {
|
|
allocator,
|
|
not_parenthesized_arrow: HashSet::new(),
|
|
decorators: Vec::new_in(allocator),
|
|
}
|
|
}
|
|
|
|
pub fn consume_decorators(&mut self) -> Vec<'a, Decorator<'a>> {
|
|
std::mem::replace(&mut self.decorators, Vec::new_in(self.allocator))
|
|
}
|
|
}
|