Skip to content

Commit

Permalink
chore(transformer): enable class-properties plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Dec 11, 2024
1 parent bcb1ea8 commit d05b53f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
//
// TODO(improve-on-babel): Consider remove this logic, because it seems no runtime behavior change.
let result = self.transform_chain_element_recursively(callee, ctx)?;
let object = callee.to_member_expression_mut().object_mut();
let object = callee.as_member_expression_mut()?.object_mut();
let (assignment, context) = self.duplicate_object(ctx.ast.move_expression(object), ctx);
*object = assignment;
let callee = ctx.ast.move_expression(&mut call_expr.callee);
Expand Down
10 changes: 2 additions & 8 deletions crates/oxc_transformer/src/options/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ impl EnvOptions {
es2021: ES2021Options { logical_assignment_operators: true },
es2022: ES2022Options {
class_static_block: true,
class_properties: if include_unfinished_plugins {
Some(ClassPropertiesOptions::default())
} else {
None
},
class_properties: Some(ClassPropertiesOptions::default()),
},
}
}
Expand Down Expand Up @@ -139,9 +135,7 @@ impl EnvOptions {
}
}
engine_targets.insert(Engine::Es, es_target.unwrap_or(ESTarget::default()).version());
let mut env_options = EnvOptions::from(engine_targets);
env_options.es2022.class_properties = None;
Ok(env_options)
Ok(EnvOptions::from(engine_targets))
}
}

Expand Down
3 changes: 1 addition & 2 deletions crates/oxc_transformer/src/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ impl From<ESTarget> for TransformOptions {
fn from(target: ESTarget) -> Self {
let mut engine_targets = EngineTargets::default();
engine_targets.insert(Engine::Es, target.version());
let mut env = EnvOptions::from(engine_targets);
env.es2022.class_properties = None;
let env = EnvOptions::from(engine_targets);
Self { env, ..Self::default() }
}
}
Expand Down

0 comments on commit d05b53f

Please sign in to comment.