Skip to content

Commit 8a149bb

Browse files
brmorrkripken
authored andcommitted
Fix incorrect assert in BinaryenHostGetOperand (#2393)
1 parent 29da5c9 commit 8a149bb

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/binaryen-c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2151,7 +2151,7 @@ BinaryenExpressionRef BinaryenHostGetOperand(BinaryenExpressionRef expr,
21512151
}
21522152

21532153
auto* expression = (Expression*)expr;
2154-
assert(expression->is<Call>());
2154+
assert(expression->is<Host>());
21552155
assert(index < static_cast<Host*>(expression)->operands.size());
21562156
return static_cast<Host*>(expression)->operands[index];
21572157
}

test/binaryen.js/kitchen-sink.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,15 @@ function test_for_each() {
941941
module.dispose();
942942
}
943943

944+
function test_expression_info() {
945+
module = new Binaryen.Module();
946+
947+
// Issue #2392
948+
console.log("getExpressionInfo(memory.grow)=" + JSON.stringify(Binaryen.getExpressionInfo(module.memory.grow(1))));
949+
950+
module.dispose();
951+
}
952+
944953
function main() {
945954
test_types();
946955
test_features();
@@ -954,6 +963,7 @@ function main() {
954963
test_parsing();
955964
test_internals();
956965
test_for_each();
966+
test_expression_info();
957967
}
958968

959969
main();

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9719,3 +9719,5 @@ sizeof Literal: 24
97199719
(nop)
97209720
)
97219721
)
9722+
9723+
getExpressionInfo(memory.grow)={"id":20,"type":1,"op":1,"nameOperand":"","operands":[1]}

0 commit comments

Comments
 (0)