Skip to content

Commit 760904a

Browse files
brmorrkripken
authored andcommitted
Convert usage of Pointer_stringify to UTF8ToString (#2403)
This fixes #2396. This converts the use of the old Pointer_stringify to the new UTF8ToString. Added a js test in kitchen-sink.js to cover this.
1 parent 8a149bb commit 760904a

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/js/binaryen.js-post.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2315,7 +2315,7 @@ Module['getExpressionInfo'] = function(expr) {
23152315
return {
23162316
'id': id,
23172317
'type': type,
2318-
'names': getAllNested(expr, Module['_BinaryenSwitchGetNumNames'], Module['_BinaryenSwitchGetName']).map(Pointer_stringify),
2318+
'names': getAllNested(expr, Module['_BinaryenSwitchGetNumNames'], Module['_BinaryenSwitchGetName']).map(UTF8ToString),
23192319
'defaultName': UTF8ToString(Module['_BinaryenSwitchGetDefaultName'](expr)),
23202320
'condition': Module['_BinaryenSwitchGetCondition'](expr),
23212321
'value': Module['_BinaryenSwitchGetValue'](expr)

test/binaryen.js/kitchen-sink.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,9 @@ function test_expression_info() {
947947
// Issue #2392
948948
console.log("getExpressionInfo(memory.grow)=" + JSON.stringify(Binaryen.getExpressionInfo(module.memory.grow(1))));
949949

950+
// Issue #2396
951+
console.log("getExpressionInfo(memory.grow)=" + JSON.stringify(Binaryen.getExpressionInfo(module.switch([ "label" ], "label", 0))));
952+
950953
module.dispose();
951954
}
952955

test/binaryen.js/kitchen-sink.js.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9721,3 +9721,4 @@ sizeof Literal: 24
97219721
)
97229722

97239723
getExpressionInfo(memory.grow)={"id":20,"type":1,"op":1,"nameOperand":"","operands":[1]}
9724+
getExpressionInfo(memory.grow)={"id":5,"type":8,"names":[""],"defaultName":"label","condition":0,"value":0}

0 commit comments

Comments
 (0)