@@ -398,6 +398,10 @@ impl<'a, 'c> ConstructorParamsSuperReplacer<'a, 'c> {
398398
399399 /// Create `_super` function to go outside class.
400400 /// `function() { <inits>; return this; }`
401+ //
402+ // TODO(improve-on-babel): When not in loose mode, inits are `_defineProperty(this, propName, value)`.
403+ // `_defineProperty` returns `this`, so last statement could be `return _defineProperty(this, propName, value)`,
404+ // rather than an additional `return this` statement.
401405 fn create_super_func ( inits : Vec < Expression < ' a > > , ctx : & mut TraverseCtx < ' a > ) -> Expression < ' a > {
402406 let outer_scope_id = ctx. current_scope_id ( ) ;
403407 let super_func_scope_id = ctx. scopes_mut ( ) . add_scope (
@@ -518,6 +522,10 @@ impl<'a, 'c> ConstructorBodyInitsInserter<'a, 'c> {
518522 ctx. generate_uid ( "args" , super_func_scope_id, SymbolFlags :: FunctionScopedVariable ) ;
519523
520524 // `super(..._args); <inits>; return this;`
525+ //
526+ // TODO(improve-on-babel): When not in loose mode, inits are `_defineProperty(this, propName, value)`.
527+ // `_defineProperty` returns `this`, so last statement could be `return _defineProperty(this, propName, value)`,
528+ // rather than an additional `return this` statement.
521529 let super_call = create_super_call_stmt ( & args_binding, ctx) ;
522530 let return_stmt = ctx. ast . statement_return ( SPAN , Some ( ctx. ast . expression_this ( SPAN ) ) ) ;
523531 let body_stmts = ctx. ast . vec_from_iter (
0 commit comments