oxc-project / oxc-project/backlog
Improve `oxc_traverse`
Open
@overlookmotel is already working on this.
Since May 8, 2024.
A-transformer
- Dominant language
- No language data
- Stars
- 7
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Various improvements to make to oxc_traverse:
- Implement
ScopeFlags(ctx.scope()). - Reduce the size of
ancestor.rsby using generics instead of repetition for*Without*types. -
AddTraverseCtx::has_ancestormethod where closure returnstrueorfalse
(or maybeSome(true),Some(false)orNone) - Check that
TraverseCtx::find_ancestorcan return an ancestor node that it found. - Set enum discriminants for
Ancestorso thatis_*can use bitwise ops +retag_stackcan write 1 byte only.- Compiler does not auto-optimize
matches!()inis_*functions. Need to do it manually. - See overlookmotel/ancestor_type branch.
- Need to handle big endian systems where bytes are in reverse order.
- That's easy, but how to run tests on big endian? Miri?
- Compiler does not auto-optimize
- Implement
DebugforAncestorand*Without*types- Implement intermediate
as_refmethod which creates a struct of references, whichDebugcan use.
- Implement intermediate
- Improve API for
Ancestor::is_via_* - API to read siblings in a Vec (see oxc-project/backlog#138).
- API to get which index current node is in a Vec (see oxc-project/backlog#138).
- API to allow mutating other branches of AST
- I think all that's required is to:
- Pass
&mut TraverseCtxtoenter_*andexit_* - Add
parent_mut,ancestor_mutmethods toTraverseCtx - Add
span_mut,directives_mutetc to all*Without*types
- Pass
- Mutable borrow on
TraverseCtxandAncestorprevents creating more than 1 mut ref at a time - Mutable borrow on
TraverseCtxunfortunately also blocks callingctx.alloc().- Can solve that with e.g.
ctx.ancestry.parent_mut()+ctx.ast.alloc()- separate properties
can be mut borrowed at same time.
- Can solve that with e.g.
- I think all that's required is to:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.