Commit graph

25 commits

Author SHA1 Message Date
Don Isaac
d3eb1c3318
fix(semantic): flag function expressions with SymbolFlags::Function (#2891)
# What This PR Does

Consider the following code snippet

```js
const x = function y () {{
```

`y` will now be flagged with `SymbolFlags::Function`. This follow's
tsc's behavior.

- [Example in OXC
Playground](https://oxc-project.github.io/oxc/playground/?code=3YCAAICagICAgICAgICxG0qZRraXZOpcCHVsSRwDq2kRR0HprsTfRRT5WMw%2Ff2epoIA%3D)
- [Example in TypeScript AST
Viewer](https://ts-ast-viewer.com/#code/MYewdgzgLgBAHjAvDAZgVzMKBLcMCeAFAJQwDeAvgFBA)
2024-04-03 10:42:11 +08:00
Dunqing
947a9f05e8
fix(semantic): missing SymbolFlags::Export when identifier used in ExportDefaultDeclaration (#2837) 2024-03-27 14:13:25 +08:00
Boshen
4f9dd98a97
feat(span): remove From<String> and From<Cow> API because they create memory leak (#2628)
closes #2621
2024-03-06 20:38:21 +08:00
Dunqing
1519b9000b
fix(semantic): incorrect scope for switch statement (#2513)
close: #2501
2024-02-26 22:54:19 +08:00
Boshen
be6b8b7ce6
[BREAKING CHANGE] Change Atom to Atom<'a> to make it safe (#2497)
Part of #2295

This PR splits the `Atom` type into `Atom<'a>` and `CompactString`.

All the AST node strings now use `Atom<'a>` instead of `Atom` to signify
it belongs to the arena.

It is now up to the user to select which form of the string to use.

This PR essentially removes the really unsafe code 


93742f89e9/crates/oxc_span/src/atom.rs (L98-L107)

which can lead to 

![image](https://github.com/oxc-project/oxc/assets/1430279/8c513c4f-19b0-4b63-b61c-e07c187c95b5)
2024-02-26 19:34:40 +08:00
Dunqing
4c2e2bdf61
fix(semantic): add export symbol flag to identifiers in export declarations (#2508)
Related PR: #2335
2024-02-26 15:48:05 +08:00
Boshen
fba66dcc75
fix(linter): improve import/no-named-as-default (#2494) 2024-02-25 21:24:08 +08:00
Dunqing
40e9541cec
feat(semantic): add export binding for ExportDefaultDeclarations in module record (#2329) 2024-02-06 22:01:16 +08:00
Dunqing
cb17a83f4f
fix(semantic): remove ignore cases (#2300) 2024-02-04 22:40:41 +08:00
Tzvi Melamed
f4674f33b2
fix(oxc_semantic): Handle short-circuiting operators in CFG (#2252)
Closes #2239
2024-02-01 21:04:28 +08:00
Tzvi Melamed
73ccf8a4da
fix(oxc_semantic): proper traversal of try statements (#2250)
Closes #2227
2024-02-01 20:46:38 +08: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
Boshen
87b9978859
refactor: move all miette usages to oxc_diagnostics 2024-01-28 16:52:16 +08:00
Boshen
fc1592bc97
refactor(semantic): remove all #[dead_code[ from tester 2024-01-25 20:27:46 +08:00
Boshen
889837704c
feat(semantic): cfg prototype (#2019)
Co-authored-by: U9G <git@u9g.dev>
2024-01-25 20:19:35 +08:00
Dunqing
6c5b22f728
refactor(semantic): improve ClassTable implmention and merge properties and methods to elements (#1902) 2024-01-05 18:38:51 +08:00
IWANABETHATGUY
4bbc977971
chore: upgrade rustc toolchain to stable 1.75.0 (#1853)
ref: 
https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html
2023-12-29 12:20:51 +08:00
Dunqing
ca04312130
feat(semantic): add ClassTable (#1793) 2023-12-25 23:59:35 +08:00
Dunqing
edc6fa4830
feat(semantic): add SymbolFlags::Function for FunctionDeclaration (#1713)
Co-authored-by: Boshen <boshenc@gmail.com>
2023-12-18 11:26:33 +08:00
Boshen
128406a8ab
Rust v1.74.0 (#1357) 2023-11-16 15:21:45 +00:00
Don Isaac
b4b39b8aa6
test(semantic): add scoping test cases (#954)
Add test cases to `oxc_semantic` that check scope flag behavior.

Also contains these tweaks:
- fix: allow disabling `with_module` on `SourceType`
- refactor: move `SymbolTester` to a separate file
- chore: add `Expect` trait & implement it on `SymbolTester`
2023-10-03 18:16:01 +13:00
Boshen
9ff12a9696
feat(linter): eslint-plugin-import/no-self-import (#878)
closes #440 #441
2023-09-10 00:12:26 +08:00
Boshen
ee54575ec1
feat(linter): add runner for import-plugin (#858) 2023-09-06 14:54:19 +08:00
Boshen
2f48bdf26f
fix(parser,semantic): make semantic own Trivias (#711)
closes #708

Making the parser return Rc<Trivias> is not a good API, and ideally
`Semantic` should just own `Trivias` so it can process or mutate it.
2023-08-10 15:30:32 +08:00
Don Isaac
38fb4c296a
test(semantic): test harness (#679)
A test harness for checking results of semantic analysis.

I got tired of writing ad-hoc test cases when finding bugs in semantic
analysis, so I made this.
2023-08-07 10:43:05 +08:00