Skip to content

Commit

Permalink
TODO comments
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Nov 22, 2024
1 parent 42ddb76 commit 7954644
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/oxc_transformer/src/es2022/class_properties/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,20 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
// TODO(improve-on-babel): If outer scope is sloppy mode, all code which is moved to outside
// the class should be wrapped in an IIFE with `'use strict'` directive. Babel doesn't do this.

// TODO: If static blocks transform is disabled, it's possible to get incorrect execution order.
// ```js
// class C {
// static x = console.log('x');
// static {
// console.log('block');
// }
// static y = console.log('y');
// }
// ```
// This logs "x", "block", "y". But in transformed output it'd be "block", "x", "y".
// Maybe force transform of static blocks if any static properties?
// Or alteratively could insert static property initializers into static blocks.

struct Constructor {
element_index: usize,
// TODO: Remove this if don't use it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {

// If `_super` function is required outside class, insert it after class.
// Note: Inserting it after class not before, so that other transforms run on it.
// TODO: That doesn't work - other transforms do not run on it.
// TODO: If static block transform is not enabled, it's possible to construct the class
// within the static block `class C { static { new C() } }` and that'd run before `_super`
// is defined. So it needs to go before the class, not after, in that case.
// TODO: `_super` should be a `let` binding, not `var`.
if let Some((super_binding, super_func)) = maybe_super_func {
if self.is_declaration {
// `var _super = function() { <inits>; return this; };`
Expand Down

0 comments on commit 7954644

Please sign in to comment.