Commit graph

10 commits

Author SHA1 Message Date
Boshen
f6752b482f
feat!(ast): make Trivias clonable by adding Arc (#3638)
This makes `Trivias` cloneable and stops us from using `Rc::new` and
`Rc::clone` everywhere.

`Trivias` is rarely cloned so an `Arc` should suffice.
2024-06-12 13:16:10 +08:00
Dunqing
5793ff1986
refactor(transformer): replace &’a Trivias with Rc<Trivias> (#3580)
`Transformer` needs to borrow `Trivias`.
8be1cc8052 (r1630711060)
2024-06-11 13:23:41 +08:00
rzvxa
61bae74f76 improvement(semantic/cfg): better CFG API (#3472) 2024-06-06 07:55:37 +00:00
rzvxa
209a99d49f improvement(semantic/cfg): rework basic blocks. (#3381)
I've replaced the `BasicBlockElement` with an `Instruction` type which would keep both the instruction kind and its associated AstNodeId.
I also removed the register scheme in the control flow in favor of a simpler approach using explicit enums.

https://github.com/oxc-project/oxc/pull/3381#issuecomment-2126622774
2024-06-06 05:41:01 +00:00
rzvxa
78e6326e48 refactor(semantic/cfg): alias petgraph's NodeIndex as BasicBlockId. (#3380)
Hides petgraph's general `NodeIndex` type behind `BasicBlockId`.
2024-05-22 03:09:38 +00:00
Boshen
a2c173de57
refactor: remove panic! from examples (#2454)
relates #2308
2024-02-20 16:18:39 +08:00
Tzvi Melamed
27681951e1
feat(oxc_semantic): Improve sample visualization (#2251)
1. add a `test.js` file to the project root:

```js
class A extends B {
  constructor() {
    try {
      super();
    } finally {
      this.a;
    }
  }
}
```

2. run:

```bash
$ cargo run -p oxc_semantic --example simple
   Compiling oxc_semantic v0.5.0 (/home/tzvipm/src/github.com/tzvipm/oxc/crates/oxc_semantic)
    Finished dev [unoptimized + debuginfo] target(s) in 32.07s
     Running `target/debug/examples/simple`
Wrote AST to: test.ast.txt
Wrote CFG blocks to: test.cfg.txt
Wrote CFG dot diagram to: test.dot
```

3. resulting graph from .dot file:


![image](https://github.com/TzviPM/oxc/assets/1950680/7163deaa-ab75-4bed-a093-946e2d6d2206)
2024-02-01 12:55:56 +00:00
Tzvi Melamed
e561457683
feat(semantic): track cfg index per ast node (#2210)
This allows looking up a cfg index from an ast node in a semantics
return. This allows later passes to better make use of the cfg.
2024-02-01 13:27:20 +08:00
Dunqing
972be831e9
fix(semantic): fix incorrect semantic example (#2198) 2024-01-29 06:48:47 +00:00
Boshen
889837704c
feat(semantic): cfg prototype (#2019)
Co-authored-by: U9G <git@u9g.dev>
2024-01-25 20:19:35 +08:00