Skip to content

Commit

Permalink
Tweak to loop rewriting.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirk-sayre-work committed Feb 15, 2023
1 parent b128e72 commit 472606f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions loop_rewriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ function rewriteSimpleControlLoop(key, val) {
if (line1.type != "CallExpression") return;
if (line1.callee.type != "MemberExpression") return;

// 1 statement in catch block.
// 1 or 2 statement in catch block.
var catch_line = val.body.body[0].handler;
if ((catch_line == undefined) || (catch_line.type != "CatchClause")) return;
var catch_body = catch_line.body;
if (catch_body.type != "BlockStatement") return;
if (catch_body.body.length != 1) return;
if ((catch_body.body.length != 1) && (catch_body.body.length != 2)) return;
catch_body = catch_body.body[0];

// Catch statement should be an assignment.
Expand Down

0 comments on commit 472606f

Please sign in to comment.