mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 12:51:57 +00:00
refactor(transformer/class-properties): TODO comments for future optimizations (#7711)
This commit is contained in:
parent
dd55b84399
commit
7344d21c81
1 changed files with 4 additions and 0 deletions
|
|
@ -403,6 +403,8 @@ impl<'a, 'c> ConstructorParamsSuperReplacer<'a, 'c> {
|
|||
// TODO(improve-on-babel): When not in loose mode, inits are `_defineProperty(this, propName, value)`.
|
||||
// `_defineProperty` returns `this`, so last statement could be `return _defineProperty(this, propName, value)`,
|
||||
// rather than an additional `return this` statement.
|
||||
// Actually this wouldn't work at present, as `_classPrivateFieldInitSpec(this, _prop, value)`
|
||||
// does not return `this`. We could alter it so it does when we have our own helper package.
|
||||
fn create_super_func(inits: Vec<Expression<'a>>, ctx: &mut TraverseCtx<'a>) -> Expression<'a> {
|
||||
let outer_scope_id = ctx.current_scope_id();
|
||||
let super_func_scope_id = ctx.scopes_mut().add_scope(
|
||||
|
|
@ -534,6 +536,8 @@ impl<'a, 'c> ConstructorBodyInitsInserter<'a, 'c> {
|
|||
// TODO(improve-on-babel): When not in loose mode, inits are `_defineProperty(this, propName, value)`.
|
||||
// `_defineProperty` returns `this`, so last statement could be `return _defineProperty(this, propName, value)`,
|
||||
// rather than an additional `return this` statement.
|
||||
// Actually this wouldn't work at present, as `_classPrivateFieldInitSpec(this, _prop, value)`
|
||||
// does not return `this`. We could alter it so it does when we have our own helper package.
|
||||
let super_call = create_super_call(&args_binding, ctx);
|
||||
let this_expr = ctx.ast.expression_this(SPAN);
|
||||
let body_exprs = ctx.ast.expression_sequence(
|
||||
|
|
|
|||
Loading…
Reference in a new issue