mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(codegen): use Stack for binary_expr_stack (#8663)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
This commit is contained in:
parent
1e9f3857ab
commit
db863a35bc
3 changed files with 5 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1635,6 +1635,7 @@ dependencies = [
|
|||
"nonmax",
|
||||
"oxc_allocator",
|
||||
"oxc_ast",
|
||||
"oxc_data_structures",
|
||||
"oxc_index",
|
||||
"oxc_mangler",
|
||||
"oxc_parser",
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ doctest = false
|
|||
[dependencies]
|
||||
oxc_allocator = { workspace = true }
|
||||
oxc_ast = { workspace = true }
|
||||
oxc_data_structures = { workspace = true }
|
||||
oxc_index = { workspace = true }
|
||||
oxc_mangler = { workspace = true }
|
||||
oxc_sourcemap = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use std::borrow::Cow;
|
|||
use oxc_ast::ast::{
|
||||
BindingIdentifier, BlockStatement, Comment, Expression, IdentifierReference, Program, Statement,
|
||||
};
|
||||
use oxc_data_structures::stack::Stack;
|
||||
use oxc_mangler::Mangler;
|
||||
use oxc_span::{GetSpan, Span, SPAN};
|
||||
use oxc_syntax::{
|
||||
|
|
@ -88,7 +89,7 @@ pub struct Codegen<'a> {
|
|||
prev_reg_exp_end: usize,
|
||||
need_space_before_dot: usize,
|
||||
print_next_indent_as_space: bool,
|
||||
binary_expr_stack: Vec<BinaryExpressionVisitor<'a>>,
|
||||
binary_expr_stack: Stack<BinaryExpressionVisitor<'a>>,
|
||||
/// Indicates the output is JSX type, it is set in [`Program::gen`] and the result
|
||||
/// is obtained by [`oxc_span::SourceType::is_jsx`]
|
||||
is_jsx: bool,
|
||||
|
|
@ -166,7 +167,7 @@ impl<'a> Codegen<'a> {
|
|||
needs_semicolon: false,
|
||||
need_space_before_dot: 0,
|
||||
print_next_indent_as_space: false,
|
||||
binary_expr_stack: Vec::with_capacity(5),
|
||||
binary_expr_stack: Stack::with_capacity(12),
|
||||
prev_op_end: 0,
|
||||
prev_reg_exp_end: 0,
|
||||
prev_op: None,
|
||||
|
|
|
|||
Loading…
Reference in a new issue