close
Skip to content
Draft
Changes from 1 commit
Commits
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
Refactor block statement construction in compiler
Replaces array spread with manual array construction for block statements, improving clarity and potentially performance when combining tryBlock and dispatchStmts.
  • Loading branch information
BlobMaster41 committed Dec 12, 2025
commit 854c198035671d8848502971dc367c168e9828d5
10 changes: 6 additions & 4 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3297,10 +3297,12 @@ export class Compiler extends DiagnosticEmitter {
dispatchStmts.push(module.unreachable());
}

let fullBlock = module.block(null, [
tryBlock,
...dispatchStmts
]);
let fullBlockStmts = new Array<ExpressionRef>(1 + dispatchStmts.length);
fullBlockStmts[0] = tryBlock;
for (let i = 0; i < dispatchStmts.length; i++) {
fullBlockStmts[1 + i] = dispatchStmts[i];
}
let fullBlock = module.block(null, fullBlockStmts);

// Merge flow states
// If finally always terminates, the whole construct terminates
Expand Down