Skip to content
Merged
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
6 changes: 3 additions & 3 deletions src/parseTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,14 +911,14 @@ function defineI64Param(name) {


function receiveI64ParamAsI53(name, onError, handleErrors = true) {
var errorHandler = handleErrors ? `if (isNaN(${name})) return ${onError}` : '';
var errorHandler = handleErrors ? `if (isNaN(${name})) { return ${onError}; }` : '';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the extra braces needed here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, I just thought it felt safer in code that's being pasted together. Like, in case onError has a semicolon in it or something. Should get minified so it seems OK.

if (WASM_BIGINT) {
// Just convert the bigint into a double.
return `${name} = bigintToI53Checked(${name});${errorHandler};`;
return `${name} = bigintToI53Checked(${name});${errorHandler}`;
}
// Convert the high/low pair to a Number, checking for
// overflow of the I53 range and returning onError in that case.
return `var ${name} = convertI32PairToI53Checked(${name}_low, ${name}_high);${errorHandler};`;
return `var ${name} = convertI32PairToI53Checked(${name}_low, ${name}_high);${errorHandler}`;
}

function receiveI64ParamAsI53Unchecked(name) {
Expand Down