w00t
SDSWC Developers
•Created by w00t on 11/28/2024 in #questions
how to migrate from visit_mut_with to Pass?
I'm upgrading the swc dependency for the qwik optimizer (https://github.com/QwikDev/qwik/blob/2ed63b78bd4a20b0f96b4e6fba9ae396916f2321/packages/qwik/src/optimizer/core/src/parse.rs#L266) and it looks like I need to convert
to
but then further down I get
use of moved value
for program
Furthermore, we use simplifier
on Module
but that latter doesn't have apply
Any help or pointers would be greatly appreciated.4 replies
SDSWC Developers
•Created by w00t on 8/1/2024 in #questions
how can I mark a context?
I'm trying to mark a call expression for checking if I visited it later, but this doesn't print that it worked:
how can I make this work?
6 replies
SDSWC Developers
•Created by w00t on 7/20/2024 in #questions
wasm build uses old swc libraries?
I'm a Rust newbie, maybe I'm doing something wrong.
I have everything building natively with the latest swc.
However, when I try to build for wasm, it's giving errors that indicate it's still using the old API?
6 replies
SDSWC Developers
•Created by w00t on 7/19/2024 in #questions
How can I rewrite this code for the moved SyntaxContext?
I'm upgrading the Qwik optimizer and this code no longer works because expr.span no longer has the SyntaxContext.
However, the only other property is
expr.expr
which is a Box<Expr>
.
How can I get at the syntax context to add the mark? Or is this the wrong approach and should I be doing one of https://swc.rs/docs/plugin/ecmascript/cheatsheet#deleting-node ? I'm not sure how to apply that though, since it marks by making the name invalid and then removes, but here I need to retain what's marked.
I don't quite understand how it works, but it removes statements that aren't used. The full code is at https://github.com/QwikDev/qwik/blob/b0802ca6dc448a82454dfba6b46f7392e0401c05/packages/qwik/src/optimizer/core/src/clean_side_effects.rs
5 replies
SDSWC Developers
•Created by w00t on 7/19/2024 in #questions
what happened with swc_ecmascript::visit::visit_expr?
I can't find the PR nor commit that removed it, nor any discussions. It's no longer exported and I don't know what to replace it with. My code is
8 replies
SDSWC Developers
•Created by w00t on 5/8/2024 in #questions
How to debug in Rust
When I'm stepping through the code, the AST is binary data. I end up having to put a lot of dbg! statements.
Is there a better way to see what the current state is?
1 replies
SDSWC Developers
•Created by w00t on 3/11/2024 in #questions
How to replace typescript::strip_with_jsx
In 1.3.89 typescript got overhauled and that removed typescript::strip_with_jsx.
What should I do instead now?
6 replies