Skip to content

Fix for binaryen.js getExpressionInfo on switch names - #2553

Merged
kripken merged 1 commit into
WebAssembly:masterfrom
bvibber:js-switch-fix
Dec 23, 2019
Merged

kripken merged 1 commit into
WebAssembly:masterfrom
bvibber:js-switch-fix

Conversation

@bvibber

@bvibber bvibber commented Dec 22, 2019 •

Copy link
Copy Markdown
Contributor

Switch label names for br_table instructions were corrupted in the
binaryen.js API layer, with each label cropped down to the number of
characters that it is an index into the list.

This was due to passing UTF8ToString as a callback method to
Array.prototype.map, which passes the index as second parameter. The
second parameter of UTF8ToString is the max number of bytes to copy,
so the initial label came out as '', then 'l', then 'la', 'lab', etc.

Switch label names for br_table instructions were corrupted in the
binaryen.js API layer, with each label cropped down to the number of
characters that it is an index into the list.

This was due to passing UTF8ToString as a callback method to
Array.prototype.map, which passes the index as second parameter. The
second parameter of UTF8ToString is the max number of bytes to copy,
so the initial label came out as '', then 'l', then 'la', 'lab', etc.

Corrected an existing test case that had the wrong output in it.

@kripken kripken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Looks like a CI job failed here due to some infra issue, re-running.

@kripken
kripken merged commit aab879d into WebAssembly:master Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants