Boshen
b11ed2cf7b
refactor(ast)!: remove useless ObjectProperty::init field ( #7220 )
...
closes https://github.com/oxc-project/backlog/issues/143
2024-11-09 09:00:29 +00:00
Boshen
0e4adc15dd
feat(ast)!: remove invalid expressions from TSEnumMemberName ( #7219 )
2024-11-09 08:48:14 +00:00
camchenry
c5485ae7ee
refactor(semantic): add ancestor_kinds iterator function ( #7217 )
...
for convenience, I've added a new function called `ancestor_kinds` which loops overall `ancestors` and gets their `AstKind`. this is a common pattern in a couple of places. I also did some somewhat related refactoring to remove places where we were manually calling `AstNode::kind` instead of using `ancestor_kinds` or calling `parent_kind`.
2024-11-09 08:04:38 +00:00
camchenry
abf1602f33
refactor(semantic): rename iter_parents to ancestors ( #7216 )
...
for consistency with the `ancestor_ids` function, this changes it to use the same terminology but make it clear it actually returns the node, not just the ID.
this is pure refactor, no functional changes here.
2024-11-09 07:07:26 +00:00
camchenry
42171eba94
refactor(semantic): rename ancestors to ancestor_ids ( #7215 )
...
pure refactor, renaming this method to make it more clear that it returns only IDs, not nodes. in preparation for the next PR.
2024-11-09 07:00:15 +00:00
Boshen
d1d187417b
feat(ast)!: change comment.span to real position that contain // and /* ( #7154 )
...
closes #7150
2024-11-06 05:10:33 +00:00
camchenry
da199c7476
fix(ecmascript): allow getting PropName for object methods ( #6967 )
...
Working on some lint rules and noticed that PropName didn't seem to be working as intended. According to the spec, we should definitely allow get/set/methods to have prop names:
https://tc39.es/ecma262/#sec-static-semantics-propname
<img width="694" alt="image" src="https://github.com/user-attachments/assets/60fdfeec-2320-4cd9-a786-901728e459b2 ">
However, we still need to retain this logic for checking `__proto__` because it has special rules.
2024-10-28 09:34:27 +00:00
Boshen
9a6a2f99c6
refactor(semantic)!: remove SymbolTable::get_symbol_id_from_span API ( #6955 )
...
closes #6867
2024-10-27 14:31:36 +00:00
Boshen
423d54cb74
refactor(rust): remove the annoying clippy::wildcard_imports ( #6860 )
2024-10-24 13:57:19 +00:00
Dunqing
5928f043b5
feat(semantic): add move_binding API in ScopeTree ( #6808 )
...
Part of #6658
This API is useful when we want to move a scope to another scope
2024-10-23 15:36:30 +00:00
Dunqing
e7e60dab68
feat(semantic): add change_parent_id API in ScopeTree ( #6807 )
...
Part of #6658
This API is useful when we want to move a scope to another scope
2024-10-23 15:29:28 +00:00
overlookmotel
10484cdeeb
feat(transformer): class static block transform ( #6733 )
...
Add ES2022 class static block transform.
2024-10-22 03:40:02 +00:00
Boshen
1248557f0e
refactor(ast)!: remove AstKind::FinallyClause ( #6744 )
2024-10-21 14:37:51 +00:00
Boshen
202c7f66c7
fix(ast)!: remove AstKind::ExpressionArrayElement and AstKind::ClassHeritage ( #6740 )
...
closes #6392
2024-10-21 13:30:48 +00:00
ottomated
e310e52ca2
feat(parser): Generate Serialize impls in ast_tools ( #6404 )
...
Beginning of #6347 . Instead of using serde-derive, we generate
`Serialize` impls manually.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
2024-10-19 09:38:44 +01:00
Boshen
435a89c6e4
refactor(oxc): remove useless allocator.alloc(program) calls ( #6571 )
2024-10-15 02:21:20 +00:00
Boshen
455dab4900
chore(oxc): rename crate oxc_syntax_operations to oxc_ecmascript ( #6469 )
2024-10-12 08:34:42 +00:00
Boshen
520096030a
refactor(oxc)!: remove passing Trivias around ( #6446 )
...
part of #6426
2024-10-11 06:09:25 +00:00
Boshen
2808973af3
feat(ast)!: add Program::comments ( #6445 )
2024-10-11 04:47:36 +00:00
Boshen
2b7be08af4
feat(ast)! add source_text to Program ( #6444 )
2024-10-11 04:13:41 +00:00
DonIsaac
01b878ecdb
feat(parser)!: use BindingIdentifier for namespace declaration names ( #6003 )
...
Use `BindingIdentifier` instead of `IdentifierName` so that AST visitors can access the bound symbol id for the namespace's name. This makes namespace consistent with other named declarations, such as `Class`, `Function`, and `TSInterfaceDeclaration`.
We should consider modifying `TSModuleDeclarationName::StringLiteral(...)` to also store a `symbol_id`, since one gets bound in semantic for it as well.
2024-10-08 08:39:31 +00:00
DonIsaac
40932f79b1
refactor(cfg): use IndexVec for storing basic blocks ( #6323 )
...
Use an `IndexVec` when storing basic blocks. This makes the link between nodes in `.graph` and elements of `.basic_blocks` more clear. I had to rename `BasicBlockId` to `BlockNodeId` to avoid a name collision. I wasn't sure what else to name the `Idx` type for the basic blocks vec.
2024-10-07 19:28:40 -04:00
DonIsaac
95ca01ccc1
refactor(cfg)!: make BasicBlock::unreachable private ( #6321 )
...
Protect `unreachable` property of basic blocks in preparation of upcoming
refactors. This is technically a breaking change.
2024-10-07 15:13:56 +00:00
Boshen
9e62396803
feat(syntax_operations): add crate oxc_syntax_operations ( #6202 )
...
I intend to add constant folding and eval logic to this crate. There are downstream tools that require these functionalities alone.
It's also reasonable to move these traits out of the `ast` crate.
2024-10-07 05:39:59 +00:00
DonIsaac
14275b138e
feat(cfg): color-code edges in CFG dot diagrams ( #6314 )
...
- add `Attrs`, a nominal struct for cleaner management of node/edge styles and
other attributes
- Style edges in DOT diagrams based on their kind
2024-10-07 02:43:30 +00:00
overlookmotel
bdd9e925f1
refactor(semantic): rename vars from ast_node_id to node_id ( #6304 )
...
Style nit. We renamed `AstNodeId` to `NodeId`, so rename vars from `ast_node_id` to `node_id` too.
2024-10-06 01:03:48 +00:00
overlookmotel
d11070051b
refactor(semantic): dereference IDs as quickly as possible ( #6303 )
...
It's better to pass around `SymbolId`s (4 bytes) than `&SymbolId`s (8 bytes). In my view, the style of dereferencing immediately is preferable.
2024-10-06 01:03:47 +00:00
overlookmotel
e19deaa102
ci(transformer): move post-transform checker to tasks crate ( #6288 )
...
Move post-transform checker into a `tasks` crate. It doesn't feel like it belongs in `oxc_semantic`. It also feels like too heavy a lump of code to put in `tasks/common`.
2024-10-05 14:48:37 +00:00
overlookmotel
d4f2ee99c1
test(transformer): tidy up transform checker ( #6287 )
...
Pure refactor. Use `oxc_semantic`'s public APIs and shorten a few lines.
2024-10-05 14:48:36 +00:00
overlookmotel
0f5afd7ede
test(transformer): transform checker output symbol name for mismatches ( #6286 )
...
Transform checker include symbol names in output for symbol mismatches. This is rather more helpful for locating bugs than just `SymbolId(3)`.
2024-10-05 14:42:06 +00:00
overlookmotel
2090fce4bc
refactor(semantic): fix lint warning in nightly ( #6110 )
...
Fix a lint warning which you only get on nightly (so appears when running Miri).
2024-09-27 13:45:16 +00:00
overlookmotel
efabfc8dac
docs(semantic): improve doc comments on Reference methods ( #6076 )
2024-09-26 12:22:31 +00:00
DonIsaac
b1af73db81
fix(semantic): do not create a global symbol for declare global {} ( #6040 )
...
Re-creation of #6004 to unblock it from down-stack PRs. @Boshen has already reviewed the previous PR and determined this to be correct behavior.
2024-09-25 08:46:00 +00:00
DonIsaac
f866781f49
feat(semantic): check for type annotations on left side of for..in and for..of iterators ( #6043 )
2024-09-25 02:51:17 +00:00
DonIsaac
8b2e9aa744
feat(semantic): check for JSDoc types in TS type annotations ( #6042 )
...
Closes #5982
2024-09-25 02:35:59 +00:00
Boshen
c8682e9fcb
fix(semantic,codegen,transformer): handle definite ! operator in variable declarator ( #6019 )
...
closes #5999
2024-09-24 08:32:05 +00:00
DonIsaac
1abfe8f02c
docs(semantic): document SymbolTable ( #5998 )
...
Re-creation of #5978 , per @overlookmotel's request
2024-09-23 23:19:41 +00:00
overlookmotel
f5eee723fa
docs(semantic): correct docs for Reference ( #5992 )
...
Correct docs. `JSXIdentifier` no longer has a reference.
2024-09-23 14:48:19 +00:00
DonIsaac
74d8714d5a
feat(semantic): add help message for invalid let x?: number ( #5969 )
2024-09-22 15:59:49 +00:00
DonIsaac
f1551d64bc
fix(semantic): ? on variable declaration type annotations is a syntax error ( #5956 )
...
Closes #5955
2024-09-22 00:01:47 +00:00
Dunqing
a23879cb96
fix(semantic): analyze ReferenceFlags incorrectly when there are nested AssignmentTarget ( #5847 )
...
close : #5801
2024-09-21 04:13:24 +00:00
Dunqing
c3e0fb68c5
perf(semantic): simplify resetting ReferenceFlags in AssignmentExpression ( #5846 )
2024-09-21 04:13:23 +00:00
Boshen
a07f03aab3
feat(transformer): sync Program::source_type after transform ( #5887 )
...
closes #5552
2024-09-19 14:41:07 +00:00
overlookmotel
d910304eac
refactor(semantic): rename lifetime on impl IntoIterator for &AstNodes ( #5881 )
...
Follow on after #5873 .
Rename lifetime. I generally consider `'a` in AST types as short for `'ast`, so using `'ast` to mean something else is confusing. Rename lifetime to `'n` (short for `'nodes`).
2024-09-19 09:30:47 +00:00
IWANABETHATGUY
a111bb69af
feat(oxc_wasm): add verbse option to debug_dot ( #5879 )
...
1. Adding a new option to control displaying `implicit error` edge.
**verbose**

**disable verbose**

2024-09-19 06:13:03 +00:00
leaysgur
f360e2c6f8
refactor(semantic): Remove redundunt is_leading check for JSDoc ( #5877 )
...
Late review for #5876 👀
`is_leading()` was already covered by `is_jsdoc()`.
9115dd947a/crates/oxc_ast/src/trivia.rs (L108-L110)
2024-09-19 06:08:31 +00:00
Boshen
9115dd947a
refactor(semantic): use Comment::attached_to for jsdoc attachment ( #5876 )
...
I can't believe tests passed on my first try 🤔
2024-09-19 04:48:30 +00:00
Boshen
db4f16a98f
refactor(semantic): call with_trivias before build_with_jsdoc ( #5875 )
2024-09-19 04:12:57 +00:00
DonIsaac
3d13c6d1f9
refactor(semantic): impl IntoIterator for &AstNodes ( #5873 )
...
Simple quality-of-life change.
2024-09-19 03:22:29 +00:00
DonIsaac
1ccf2907be
docs(semantic): document AstNode and AstNodes ( #5872 )
...
Part of #5870
2024-09-19 03:22:29 +00:00