Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Draft
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c1e72b9
WIP
addaleax Apr 2, 2024
e3af42a
fixup: VecDeque
addaleax Apr 3, 2024
ac0a79d
fixup: IIFE wrapping WIP
addaleax Apr 3, 2024
b1db86d
fixup: ...
addaleax Apr 4, 2024
dc08b18
fixup: Kevin’s suggestions
addaleax Apr 4, 2024
7ee0641
fixup: invert condition so the difference shows in CI perf tests
addaleax Apr 10, 2024
2a4996e
fixup: include compiled WASM in compile_ts
addaleax Apr 10, 2024
5d9ad16
fixup: Rust in CI ...
addaleax Apr 10, 2024
0af48ce
fixup: regenerate automatically created files after rebase
addaleax Mar 6, 2025
aaebeae
fixup: handle e.g. `function foo(a=1){}`
addaleax Mar 9, 2025
75a7ba4
WIP
addaleax Mar 10, 2025
4d31176
fixup: snapshot fix
addaleax Mar 11, 2025
fae056a
fixup: literal object keys work
addaleax Mar 11, 2025
dfce63f
fixup: template elements should not receive tags
addaleax Mar 23, 2025
e245d9d
fixup: account for typeof + parentheses
addaleax Mar 23, 2025
64878fb
fixup: set sync rv for arrow functions
addaleax Mar 24, 2025
1ec867e
fixup: handle for-of/in lvalues, labels
addaleax Mar 24, 2025
7d3a10d
fixup: handle bracketed call expressions
addaleax Mar 24, 2025
5e08699
fixup: slash merging
addaleax Mar 24, 2025
f394028
fixup: perf
addaleax Mar 24, 2025
7cad72b
fixup: unnecessary .iter()
addaleax Mar 25, 2025
96441cd
fixup: initialize immediately after class def
addaleax Mar 25, 2025
4a9a651
fixup: extend ; safeguarding
addaleax Mar 25, 2025
0426e16
fixup: more semicolon safeguards
addaleax Mar 25, 2025
1d3e357
fixup: Rust cleanups
addaleax Mar 31, 2025
20f3965
fixup: explicitly install wasm-pack
addaleax May 6, 2025
fb5dada
fixup: add rust executable variant
addaleax May 7, 2025
3dc6cd4
fixup: switch to oxc parser
addaleax May 7, 2025
1273afd
fixup: post-rewrite fixes
addaleax May 7, 2025
baf2755
fixup: `cargo fmt`
addaleax May 7, 2025
74b48d5
fixup: readability
addaleax May 8, 2025
0c167a9
fixup: fmt
addaleax May 8, 2025
288b40e
fixup: add c addon variant
addaleax May 8, 2025
482bc98
fixup: typo discovered during walkthrough :)
addaleax May 9, 2025
5470160
Merge remote-tracking branch 'origin/main' into async-rewriter3
addaleax Sep 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: Kevin’s suggestions
  • Loading branch information
addaleax committed May 8, 2025
commit dc08b1894f8698a1ac887f0d6ecde0d373cff967
27 changes: 11 additions & 16 deletions 27 packages/async-rewriter3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ impl InsertionList {
}

fn is_block(body: &ExprOrBlock) -> bool {
match body {
ExprOrBlock::Block(_) => { true }
ExprOrBlock::Expr(_) => { false }
}
return matches!(body, ExprOrBlock::Block(_));
}

fn make_start_fn_insertion(offset: TextSize) -> Insertion {
Expand Down Expand Up @@ -165,15 +162,13 @@ fn add_all_variables_from_declaration(patterns: impl Iterator<Item = impl Borrow
p.name().map(|name| ret.add_variable(name.to_string()));
},
Pattern::RestPattern(p) => {
let pat = p.pat();
if pat.is_some() {
ret.append(&mut add_all_variables_from_declaration([&pat.unwrap()].into_iter()));
if let Some(pat) = p.pat() {
ret.append(&mut add_all_variables_from_declaration([&pat].into_iter()));
}
},
Pattern::AssignPattern(p) => {
let key = p.key();
if key.is_some() {
ret.append(&mut add_all_variables_from_declaration([&key.unwrap()].into_iter()));
if let Some(key) = p.key() {
ret.append(&mut add_all_variables_from_declaration([&key].into_iter()));
}
},
Pattern::ObjectPattern(p) => {
Expand All @@ -183,8 +178,8 @@ fn add_all_variables_from_declaration(patterns: impl Iterator<Item = impl Borrow
ret.append(&mut add_all_variables_from_declaration([&Pattern::AssignPattern(p)].into_iter()));
}
ObjectPatternProp::KeyValuePattern(p) => {
if p.key().is_some() {
match p.key().unwrap() {
if let Some(key) = p.key() {
match key {
PropName::Ident(ident) => {
ret.add_variable(ident.text());
}
Expand Down Expand Up @@ -276,12 +271,12 @@ fn collect_insertions(node: &SyntaxNode, nesting_depth: u32) -> InsertionList {
if ExprStmt::can_cast(child.kind()) && !has_function_parent {
let as_expr_stmt = ExprStmt::cast(child).unwrap();
let expr_range = as_expr_stmt.expr().map(|e| e.syntax().text_range());
if expr_range.is_some() {
insertions.push_back(Insertion::new(expr_range.unwrap().start(), "_cr = ("));
if let Some(start) = expr_range.map(|r| r.start()) {
insertions.push_back(Insertion::new(start, "_cr = ("));
}
insertions.append(child_insertions);
if expr_range.is_some() {
insertions.push_back(Insertion::new(expr_range.unwrap().end(), ")"));
if let Some(end) = expr_range.map(|r| r.end()) {
insertions.push_back(Insertion::new(end, ")"));
}
continue;
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.