Skip to content

Commit

Permalink
refactor(transformer/class-properties): rename `assert_expr_is_not_pa…
Browse files Browse the repository at this point in the history
…renthesis_or_typescript_syntax`
  • Loading branch information
overlookmotel committed Dec 11, 2024
1 parent ce43087 commit 6f59d27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions crates/oxc_transformer/src/es2022/class_properties/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{common::helper_loader::Helper, TransformCtx};
use super::{
private_props::ResolvedPrivateProp,
utils::{
assert_expr_neither_parenthesis_nor_typescript_syntax, create_assignment,
assert_expr_is_not_parenthesis_or_typescript_syntax, create_assignment,
create_underscore_ident_name,
},
ClassProperties,
Expand Down Expand Up @@ -1019,7 +1019,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
self.transform_call_expression_of_chain_expression(call, ctx)
}
_ => {
assert_expr_neither_parenthesis_nor_typescript_syntax(expr, &self.ctx.source_path);
assert_expr_is_not_parenthesis_or_typescript_syntax(expr, &self.ctx.source_path);
None
}
}
Expand Down Expand Up @@ -1611,7 +1611,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
object: Expression<'a>,
ctx: &mut TraverseCtx<'a>,
) -> (Expression<'a>, Expression<'a>) {
assert_expr_neither_parenthesis_nor_typescript_syntax(&object, &self.ctx.source_path);
assert_expr_is_not_parenthesis_or_typescript_syntax(&object, &self.ctx.source_path);
self.ctx.duplicate_expression(object, false, ctx)
}

Expand All @@ -1630,7 +1630,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
object: Expression<'a>,
ctx: &mut TraverseCtx<'a>,
) -> (Expression<'a>, Expression<'a>, Expression<'a>) {
assert_expr_neither_parenthesis_nor_typescript_syntax(&object, &self.ctx.source_path);
assert_expr_is_not_parenthesis_or_typescript_syntax(&object, &self.ctx.source_path);
self.ctx.duplicate_expression_twice(object, false, ctx)
}

Expand Down
5 changes: 4 additions & 1 deletion crates/oxc_transformer/src/es2022/class_properties/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ pub(super) fn create_underscore_ident_name<'a>(ctx: &mut TraverseCtx<'a>) -> Ide
ctx.ast.identifier_name(SPAN, Atom::from("_"))
}

/// Debug assert that an `Expression` is not `ParenthesizedExpression` or TS syntax
/// (e.g. `TSAsExpression`).
//
// `#[inline(always)]` because this is a no-op in release mode
#[expect(clippy::inline_always)]
#[inline(always)]
pub(super) fn assert_expr_neither_parenthesis_nor_typescript_syntax(
pub(super) fn assert_expr_is_not_parenthesis_or_typescript_syntax(
expr: &Expression,
path: &PathBuf,
) {
Expand Down

0 comments on commit 6f59d27

Please sign in to comment.