oxc-project / backlog

backlog for collborators only
1 stars 0 forks source link

Keep symbols and scopes in sync across the whole compiler pipeline #85

Open Boshen opened 1 month ago

Boshen commented 1 month ago

Rolldown currently runs semantic builder numerous times to keep symbols and scopes in sync:

https://github.com/rolldown/rolldown/blob/main/crates/rolldown/src/utils/pre_process_ecma_ast.rs

  1. transformer
  2. dead code elimination (may need one soon)
  3. rebuild symbols and scopes to keep everything in sync
  // We have to re-create the symbol table and scope tree after the transformation so far to make sure they are up-to-date.
  let (symbols, scopes) = ast.make_symbol_table_and_scope_tree();

And then eventually on the chunk level:

  1. minifier
  2. mangler
overlookmotel commented 1 month ago

I think https://github.com/oxc-project/oxc/issues/4790 is key to this. If we build that testing setup for transformer, we can also use it for minifier, DCE, etc to make sure they're all behaving.