From f8995e48df23137fb4d8a2da5979cb9e381efe98 Mon Sep 17 00:00:00 2001 From: sorte1 Date: Fri, 20 Nov 2026 14:47:18 +0100 Subject: [PATCH 1/2] fix: keep assembled object bases and optional method calls out of the dead-branch proof --- .../src/control_flow_object/assembled.rs | 65 ++++++++++-------- .../src/control_flow_object/dead.rs | 15 ++++- .../tests/data/obfuscator_sweep/cfo-r6-a6.js | 9 +++ .../tests/data/obfuscator_sweep/cfo-r6-a7.js | 8 +++ .../obfuscator_sweep/cfo-r6-f1-computed.js | 10 +++ .../data/obfuscator_sweep/cfo-r6-f1-cond.js | 10 +++ .../data/obfuscator_sweep/cfo-r6-f1-fn.js | 10 +++ .../obfuscator_sweep/cfo-r6-f1-halfrun.js | 10 +++ .../obfuscator_sweep/cfo-r6-f1-halfrun2.js | 10 +++ .../cfo-r6-f1-order-v-first.js | 10 +++ .../obfuscator_sweep/cfo-r6-f1-twoalias.js | 11 ++++ .../tests/data/obfuscator_sweep/cfo-r6-f1a.js | 10 +++ .../tests/data/obfuscator_sweep/cfo-r6-f1b.js | 10 +++ .../tests/data/obfuscator_sweep/cfo-r6-f1c.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-asm-del.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-delp.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-opt.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-optc.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-optcall.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-optn.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-optp.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-optt.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-paren.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-plain.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-ptag.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-seq.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-asm-tag.js | 12 ++++ .../obfuscator_sweep/cfo-r6-f2-lit-del.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-delp.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-opt.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-optc.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-optcall.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-optn.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-optp.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-optt.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-paren.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-plain.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-ptag.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-seq.js | 9 +++ .../obfuscator_sweep/cfo-r6-f2-lit-tag.js | 9 +++ .../tests/data/obfuscator_sweep/cfo-r6-f2a.js | 12 ++++ .../tests/data/obfuscator_sweep/cfo-r6-f2b.js | 9 +++ .../tests/data/obfuscator_sweep/cfo-r6-f2c.js | 8 +++ .../tests/data/obfuscator_sweep/cfo-r6-h1.js | 12 ++++ .../tests/data/obfuscator_sweep/cfo-r6-h2.js | 12 ++++ .../tests/data/obfuscator_sweep/cfo-r6-h3.js | 12 ++++ .../tests/data/obfuscator_sweep/cfo-r6-h4.js | 12 ++++ .../tests/data/obfuscator_sweep/cfo-r6-h5.js | 12 ++++ .../tests/data/obfuscator_sweep/cfo-r6-h6.js | 12 ++++ .../tests/data/obfuscator_sweep/cfo-r6-h7.js | 12 ++++ .../tests/data/obfuscator_sweep/cfo-r6-j1.js | 9 +++ .../tests/data/obfuscator_sweep/cfo-r6-j2.js | 9 +++ .../tests/data/obfuscator_sweep/cfo-r6-j3.js | 9 +++ .../tests/data/obfuscator_sweep/cfo-r6-j4.js | 9 +++ .../tests/data/obfuscator_sweep/cfo-r6-j5.js | 9 +++ .../tests/data/obfuscator_sweep/cfo-r6-j6.js | 9 +++ .../tests/data/obfuscator_sweep/cfo-r6-j7.js | 9 +++ crates/untwist/tests/obfuscator_sweep_rows.rs | 66 +++++++++++++++++++ 58 files changed, 681 insertions(+), 31 deletions(-) create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-a6.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-a7.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-computed.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-cond.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-fn.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-halfrun.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-halfrun2.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-order-v-first.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-twoalias.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1a.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1b.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1c.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-del.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-delp.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-opt.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optc.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optcall.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optn.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optp.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optt.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-paren.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-plain.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-ptag.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-seq.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-tag.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-del.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-delp.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-opt.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optc.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optcall.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optn.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optp.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optt.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-paren.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-plain.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-ptag.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-seq.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-tag.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2a.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2b.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2c.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h1.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h2.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h3.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h4.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h5.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h6.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h7.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j1.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j2.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j3.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j4.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j5.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j6.js create mode 100644 crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j7.js diff --git a/crates/untwist-deobfuscate/src/control_flow_object/assembled.rs b/crates/untwist-deobfuscate/src/control_flow_object/assembled.rs index 3aac74cc..b05bfde7 100644 --- a/crates/untwist-deobfuscate/src/control_flow_object/assembled.rs +++ b/crates/untwist-deobfuscate/src/control_flow_object/assembled.rs @@ -144,6 +144,10 @@ impl<'p> Assembled<'p> { self.base } + pub(super) fn adds_keys(&self) -> bool { + !self.added.is_empty() + } + pub(super) fn reaches_its_receiver(&self) -> bool { let mut scan = ThisFree { found: false }; scan.visit_object_expression(self.object); @@ -284,36 +288,41 @@ impl<'a> VisitJs<'a> for AliasUses<'_, '_, '_> { self.live = true; } } - match it { - Expression::CallExpression(call) => { - let callee = call.callee.without_parentheses(); - if let Some((id, assembled)) = self.receiver(callee) { - let safe = member_parts(callee) - .and_then(|(_, name)| assembled.property(&name)) - .is_some_and(this_free_function); - if !safe { - self.risky.insert(address_of(id)); - } - } - } - Expression::TaggedTemplateExpression(tagged) => { - if let Some((id, _)) = self.receiver(tagged.tag.without_parentheses()) { - self.risky.insert(address_of(id)); - } - } - Expression::UnaryExpression(unary) if unary.operator == UnaryOperator::Delete => { - if let Some((id, _)) = self.receiver(unary.argument.without_parentheses()) { - self.risky.insert(address_of(id)); - } - } - _ => {} - } walk_js::walk_expression(self, it); if dead { self.depth -= 1; } } + fn visit_call_expression(&mut self, it: &CallExpression<'a>) { + let callee = it.callee.without_parentheses(); + if let Some((id, assembled)) = self.receiver(callee) { + let safe = member_parts(callee) + .and_then(|(_, name)| assembled.property(&name)) + .is_some_and(this_free_function); + if !safe { + self.risky.insert(address_of(id)); + } + } + walk_js::walk_call_expression(self, it); + } + + fn visit_tagged_template_expression(&mut self, it: &TaggedTemplateExpression<'a>) { + if let Some((id, _)) = self.receiver(it.tag.without_parentheses()) { + self.risky.insert(address_of(id)); + } + walk_js::walk_tagged_template_expression(self, it); + } + + fn visit_unary_expression(&mut self, it: &UnaryExpression<'a>) { + if it.operator == UnaryOperator::Delete { + if let Some((id, _)) = self.receiver(it.argument.without_parentheses()) { + self.risky.insert(address_of(id)); + } + } + walk_js::walk_unary_expression(self, it); + } + fn visit_identifier_reference(&mut self, it: &IdentifierReference<'a>) { if self.depth > 0 || self.live { return; @@ -340,10 +349,10 @@ pub(super) fn aliases_mutated_only_in_dead<'k, 'p>( where 'p: 'k, { - let mut objects = FxHashMap::default(); - for (alias, assembled) in used { - objects.insert(alias, assembled); - objects.insert(assembled.base, assembled); + let used: Vec<(SymbolId, &'k Assembled<'p>)> = used.collect(); + let mut objects: FxHashMap> = used.iter().copied().collect(); + for (_, assembled) in &used { + objects.entry(assembled.base).or_insert(*assembled); } let mut roots: Vec<&FunctionBody<'_>> = Vec::new(); let mut whole = false; diff --git a/crates/untwist-deobfuscate/src/control_flow_object/dead.rs b/crates/untwist-deobfuscate/src/control_flow_object/dead.rs index f1ae2bfc..c2d680b3 100644 --- a/crates/untwist-deobfuscate/src/control_flow_object/dead.rs +++ b/crates/untwist-deobfuscate/src/control_flow_object/dead.rs @@ -371,6 +371,7 @@ pub(super) struct Branches<'p> { objects: FxHashMap>, assembled: FxHashMap>, optimistic: FxHashMap>, + rebuilt: FxHashSet, hazard: bool, program: Option<&'p Program<'p>>, readonly: RefCell>>, @@ -563,9 +564,13 @@ impl<'p> VisitJs<'p> for BranchScan<'_, 'p> { let Some(root) = self.bodies.last().copied() else { break; }; - let found = assembled_alias(&it[start..], self.scoping) - .filter(|(_, assembled)| !assembled.reaches_its_receiver()); - if let Some((alias, assembled)) = found { + let Some((alias, assembled)) = assembled_alias(&it[start..], self.scoping) else { + continue; + }; + if assembled.adds_keys() { + self.found.rebuilt.insert(assembled.base()); + } + if !assembled.reaches_its_receiver() { self.found .assembled .insert(alias, assembled.within(Some(root))); @@ -624,6 +629,10 @@ pub(super) fn predicate_branches<'p>(program: &'p Program<'p>, scoping: &Scoping !writes.may_write(*alias) && !writes.may_write(assembled.base()) }); } + for base in std::mem::take(&mut scan.found.rebuilt) { + scan.found.objects.remove(&base); + scan.found.optimistic.remove(&base); + } scan.found.program = Some(program); scan.found.hazard = untwist_core::semantic::scope_hazard(scoping).is_some(); scan.found diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-a6.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-a6.js new file mode 100644 index 00000000..4280b1ba --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-a6.js @@ -0,0 +1,9 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.abcde }; + m.kkkkk = "y"; + const v = m; + if (m.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1), v.kkkkk); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-a7.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-a7.js new file mode 100644 index 00000000..2d326db3 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-a7.js @@ -0,0 +1,8 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.abcde }; + m.kkkkk = "y"; + if (m.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-computed.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-computed.js new file mode 100644 index 00000000..d0f6a7ad --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-computed.js @@ -0,0 +1,10 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.abcde }; + m["kkkkk"] = "y"; + const v = m; + if (m["kkkkk"] === "x") { console.log("then"); } else { d.abcde = "changed"; } + if (v["kkkkk"] === "y") { console.log("alias"); } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-cond.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-cond.js new file mode 100644 index 00000000..2e4e046e --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-cond.js @@ -0,0 +1,10 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.abcde }; + m.kkkkk = "y"; + const v = m; + console.log(v.kkkkk === "y" ? "alias" : "no"); + console.log(m.kkkkk === "x" ? "then" : (d.abcde = "changed")); + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-fn.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-fn.js new file mode 100644 index 00000000..fea402a1 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-fn.js @@ -0,0 +1,10 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.fghij }; + m.kkkkk = function (a, b) { return a !== b; }; + const v = m; + if (m.kkkkk(1, 1)) { console.log("then"); } else { d.abcde = "changed"; } + if (v.kkkkk(1, 2)) { console.log("alias"); } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-halfrun.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-halfrun.js new file mode 100644 index 00000000..c0d45b28 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-halfrun.js @@ -0,0 +1,10 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.abcde }; + m.ggggg = (function () { if (m.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } return 1; })(); + m.kkkkk = "y"; + const v = m; + if (v.kkkkk === "y") { console.log("alias"); } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-halfrun2.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-halfrun2.js new file mode 100644 index 00000000..d4377900 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-halfrun2.js @@ -0,0 +1,10 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: "y" }; + m.kkkkk = d.abcde; + m.ggggg = (function () { if (m.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } return 1; })(); + const v = m; + if (v.kkkkk === "x") { console.log("alias"); } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-order-v-first.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-order-v-first.js new file mode 100644 index 00000000..48212fa7 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-order-v-first.js @@ -0,0 +1,10 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.abcde }; + m.kkkkk = "y"; + const v = m; + if (v.kkkkk === "y") { console.log("alias"); } + if (m.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-twoalias.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-twoalias.js new file mode 100644 index 00000000..7de8fff9 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1-twoalias.js @@ -0,0 +1,11 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.abcde }; + m.kkkkk = "y"; + const v = m; + const u = m; + if (u.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + if (v.kkkkk === "y") { console.log("alias"); } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1a.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1a.js new file mode 100644 index 00000000..4e4d3cf7 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1a.js @@ -0,0 +1,10 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.abcde }; + m.kkkkk = "y"; + const v = m; + if (m.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + if (v.kkkkk === "y") { console.log("alias"); } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1b.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1b.js new file mode 100644 index 00000000..9d72e6bc --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1b.js @@ -0,0 +1,10 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { bbbbb: d.abcde }; + m.bbbbb = "y"; + m.aaaaa = m.bbbbb; + const v = m; + if (v.aaaaa === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1c.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1c.js new file mode 100644 index 00000000..f09c3be8 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f1c.js @@ -0,0 +1,9 @@ +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = { kkkkk: d.abcde }; + m.kkkkk = "y"; + const v = m; + if (d.fghij(m.kkkkk, v.kkkkk)) { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-del.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-del.js new file mode 100644 index 00000000..f6bbd1b8 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-del.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + delete v.kkkkk; + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-delp.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-delp.js new file mode 100644 index 00000000..1796d936 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-delp.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + delete (v.kkkkk); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-opt.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-opt.js new file mode 100644 index 00000000..989683d8 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-opt.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v.fffff?.(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optc.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optc.js new file mode 100644 index 00000000..690aafd7 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optc.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v["fffff"]?.(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optcall.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optcall.js new file mode 100644 index 00000000..ef0f282f --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optcall.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v.fffff?.call(v); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optn.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optn.js new file mode 100644 index 00000000..68c48df6 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optn.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + (v.fffff?.()); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optp.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optp.js new file mode 100644 index 00000000..cbbf342b --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optp.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + (v.fffff)?.(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optt.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optt.js new file mode 100644 index 00000000..1d723956 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-optt.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; return {}; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v.fffff?.().x; + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-paren.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-paren.js new file mode 100644 index 00000000..11df5024 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-paren.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + (v.fffff)(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-plain.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-plain.js new file mode 100644 index 00000000..284f28fa --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-plain.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v.fffff(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-ptag.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-ptag.js new file mode 100644 index 00000000..c7f3f563 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-ptag.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + (v.fffff)`t`; + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-seq.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-seq.js new file mode 100644 index 00000000..c10a3a8a --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-seq.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + (0, v.fffff)(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-tag.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-tag.js new file mode 100644 index 00000000..ad12673d --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-asm-tag.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v.fffff`t`; + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-del.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-del.js new file mode 100644 index 00000000..74afd51a --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-del.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + delete v.kkkkk; + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-delp.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-delp.js new file mode 100644 index 00000000..bedee03d --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-delp.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + delete (v.kkkkk); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-opt.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-opt.js new file mode 100644 index 00000000..aa414be0 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-opt.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v.fffff?.(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optc.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optc.js new file mode 100644 index 00000000..8563f802 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optc.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v["fffff"]?.(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optcall.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optcall.js new file mode 100644 index 00000000..8ef238a8 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optcall.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v.fffff?.call(v); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optn.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optn.js new file mode 100644 index 00000000..b70876e7 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optn.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + (v.fffff?.()); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optp.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optp.js new file mode 100644 index 00000000..37c7e0ed --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optp.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + (v.fffff)?.(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optt.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optt.js new file mode 100644 index 00000000..9c0556f9 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-optt.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; return {}; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v.fffff?.().x; + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-paren.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-paren.js new file mode 100644 index 00000000..bbc61397 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-paren.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + (v.fffff)(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-plain.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-plain.js new file mode 100644 index 00000000..4dc7386e --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-plain.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v.fffff(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-ptag.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-ptag.js new file mode 100644 index 00000000..02d71b65 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-ptag.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + (v.fffff)`t`; + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-seq.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-seq.js new file mode 100644 index 00000000..e3395ef0 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-seq.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + (0, v.fffff)(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-tag.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-tag.js new file mode 100644 index 00000000..e0d601bc --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2-lit-tag.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v.fffff`t`; + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2a.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2a.js new file mode 100644 index 00000000..989683d8 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2a.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v.fffff?.(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2b.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2b.js new file mode 100644 index 00000000..be7a39bf --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2b.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + (v["fffff"])?.(); + if (v.kkkkk === "x") { console.log("then"); } else { d.abcde = "changed"; } + console.log(d.abcde); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2c.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2c.js new file mode 100644 index 00000000..191fc207 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-f2c.js @@ -0,0 +1,8 @@ +function f(setter) { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v.fffff?.().x; + console.log(d.fghij(v.kkkkk, "x") ? "then" : (d.abcde = "changed")); + console.log(d.abcde); +} +f(function () { this.kkkkk = "y"; return {}; }); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h1.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h1.js new file mode 100644 index 00000000..cb2c5cc8 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h1.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v?.fffff(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h2.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h2.js new file mode 100644 index 00000000..57208c36 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h2.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v.fffff?.(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h3.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h3.js new file mode 100644 index 00000000..41389d27 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h3.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v?.["fffff"](); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h4.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h4.js new file mode 100644 index 00000000..f1e20e3c --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h4.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + (v?.fffff)(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h5.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h5.js new file mode 100644 index 00000000..23952ef0 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h5.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v.fffff(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h6.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h6.js new file mode 100644 index 00000000..a47ae6e6 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h6.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v?.fffff?.(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h7.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h7.js new file mode 100644 index 00000000..79620cea --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-h7.js @@ -0,0 +1,12 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const m = {}; + m.kkkkk = d.abcde; + m.fffff = setter; + const v = m; + v.fffff?.call(v); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j1.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j1.js new file mode 100644 index 00000000..9ce66d8b --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j1.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v?.fffff(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j2.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j2.js new file mode 100644 index 00000000..eda7ad7a --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j2.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v.fffff?.(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j3.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j3.js new file mode 100644 index 00000000..91e2d161 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j3.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v?.["fffff"](); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j4.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j4.js new file mode 100644 index 00000000..ce57bcca --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j4.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + (v?.fffff)(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j5.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j5.js new file mode 100644 index 00000000..f9bf0c68 --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j5.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v.fffff(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j6.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j6.js new file mode 100644 index 00000000..7d7cf9cc --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j6.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v?.fffff?.(); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j7.js b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j7.js new file mode 100644 index 00000000..6b3e287a --- /dev/null +++ b/crates/untwist/tests/data/obfuscator_sweep/cfo-r6-j7.js @@ -0,0 +1,9 @@ +function setter() { this.kkkkk = "y"; } +function f() { + const d = { abcde: "x", fghij: function (a, b) { return a === b; } }; + const v = { kkkkk: d.abcde, fffff: setter }; + v.fffff?.call(v); + if (v.kkkkk === "x") { console.log("live"); } else { d.abcde = "changed"; } + console.log(d.abcde, d.fghij(1, 1)); +} +f(); diff --git a/crates/untwist/tests/obfuscator_sweep_rows.rs b/crates/untwist/tests/obfuscator_sweep_rows.rs index e19aad60..ae8e9083 100644 --- a/crates/untwist/tests/obfuscator_sweep_rows.rs +++ b/crates/untwist/tests/obfuscator_sweep_rows.rs @@ -638,3 +638,69 @@ fn a_body_that_reads_its_own_name_or_a_with_binding_prints_like_node_in_both_lan fn a_body_under_a_direct_eval_that_declares_its_global_prints_like_node_in_the_default_lane() { prints_like_node_in(FOLDED_NAME_HAZARDS_UNDER_EVAL, &[default_code]); } + +const ASSEMBLED_BASE_AND_OPTIONAL_CALLS: &[&str] = &[ + "cfo-r6-a6", + "cfo-r6-a7", + "cfo-r6-f1a", + "cfo-r6-f1b", + "cfo-r6-f1c", + "cfo-r6-f1-computed", + "cfo-r6-f1-cond", + "cfo-r6-f1-fn", + "cfo-r6-f1-halfrun2", + "cfo-r6-f1-halfrun", + "cfo-r6-f1-order-v-first", + "cfo-r6-f1-twoalias", + "cfo-r6-f2a", + "cfo-r6-f2-asm-del", + "cfo-r6-f2-asm-delp", + "cfo-r6-f2-asm-optcall", + "cfo-r6-f2-asm-optc", + "cfo-r6-f2-asm-opt", + "cfo-r6-f2-asm-optn", + "cfo-r6-f2-asm-optp", + "cfo-r6-f2-asm-optt", + "cfo-r6-f2-asm-paren", + "cfo-r6-f2-asm-plain", + "cfo-r6-f2-asm-ptag", + "cfo-r6-f2-asm-seq", + "cfo-r6-f2-asm-tag", + "cfo-r6-f2b", + "cfo-r6-f2c", + "cfo-r6-f2-lit-del", + "cfo-r6-f2-lit-delp", + "cfo-r6-f2-lit-optcall", + "cfo-r6-f2-lit-optc", + "cfo-r6-f2-lit-opt", + "cfo-r6-f2-lit-optn", + "cfo-r6-f2-lit-optp", + "cfo-r6-f2-lit-optt", + "cfo-r6-f2-lit-paren", + "cfo-r6-f2-lit-plain", + "cfo-r6-f2-lit-ptag", + "cfo-r6-f2-lit-seq", + "cfo-r6-f2-lit-tag", + "cfo-r6-h1", + "cfo-r6-h2", + "cfo-r6-h3", + "cfo-r6-h4", + "cfo-r6-h5", + "cfo-r6-h6", + "cfo-r6-h7", + "cfo-r6-j1", + "cfo-r6-j2", + "cfo-r6-j3", + "cfo-r6-j4", + "cfo-r6-j5", + "cfo-r6-j6", + "cfo-r6-j7", +]; + +#[test] +fn an_assembled_base_read_or_an_optional_method_call_prints_like_node_in_both_lanes() { + prints_like_node_in( + ASSEMBLED_BASE_AND_OPTIONAL_CALLS, + &[default_code, unsafe_lane], + ); +} From e59cf27954aa4b2eb2896969e05bfa10896742d7 Mon Sep 17 00:00:00 2001 From: sorte1 Date: Fri, 20 Nov 2026 19:08:47 +0100 Subject: [PATCH 2/2] ci(web): wasm baseline 14,930,000 (cap 16,423,000) for 16,421,169 bytes with the assembled-base and optional-call fixes --- web/scripts/size.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/scripts/size.ts b/web/scripts/size.ts index 19c5771c..e70f9cb7 100644 --- a/web/scripts/size.ts +++ b/web/scripts/size.ts @@ -12,7 +12,7 @@ const INITIAL_JS_GZIP = 190_000; const CSS_GZIP = 15_000; const FONT_BYTES = 120_000; const SW_GZIP = 4_000; -const WASM_BASELINE_BYTES = 14_943_000; +const WASM_BASELINE_BYTES = 14_948_000; const WASM_GROWTH = 0.1; const gzip = (bytes: Buffer): number => gzipSync(bytes, { level: 9 }).length;